Typsystems
Type systems are formal frameworks in programming languages that assign types to values and expressions and enforce rules about how those values can be used. They aim to prevent certain kinds of errors, document intent, and sometimes enable optimizations and safer interfaces. A type system typically includes rules for composing values, function application, and data structures, and a mechanism for checking or inferring types.
Static versus dynamic: static type systems decide types at compile time; dynamic type systems decide at run
Subtyping and polymorphism: subtyping allows a value of a subtype to be used where a supertype is
Type inference can deduce types automatically, reducing annotations, as in ML or Haskell. Dependent types generalize
Languages illustrate the spectrum: Java, C, C++, C#, and TypeScript feature static types with varying degrees
Ultimately, a well-designed type system balances safety and expressiveness, providing guarantees about program behavior while remaining