1.6  Modern type system.

“God is real, unless declared integer.”
J.Allan Toogood

The Fortran designers found it necessary to distinguish variables by type, primarily so that the compiler could reliably distinguish integer and floating point variables in order to (for example) implement * using the appropriate hardware multiply instruction.

Having a host of state of the art language implementation problems on their hands, they understandably enough implemented the simplest, most obvious type system capable of satisfying this requirement.

Unfortunately, succeeding mainstream languages have picked up that type system with only minor tweaks.

The result is a type system which is burdemsome to the practicing programmer, requiring the program text to be littered everywhere with tedious type declarations.

Worse, the type system is low-level and inflexible, making it hard to express necessary things, often forcing programmers to circumvent the type system via casts, thus giving up much of the potential code quality benefits of strong type checking.

Starting in the 1970s, a succession of researchers beginning with Haskell Curry, Robert Feys, Luis Damas, Robin Milner and Roger Hindley have developed a modern class of type systems based on using Prolog-style unification to propagate type information through the program (thus making explicit type declarations necessary only at compilation unit boundaries, allowing much cleaner source code) while also introducing type functions and variables which allow the programmer much greater freedom expression.

It is now possible and increasingly common to write entire pages of type code which execute only at compile time, having no runtime correlate whatever. This goes under a variety of names such as “phantom types”. In essence, the compiler typechecker is becoming a programmable engine which the software developer may use to verify selected properties of the software product, replacing test-and-hope with check-and-know.

Type system design and implementation is currently a very active area of research.

Mythryl inherits from SML a mature, well understood, center of the road variant of classic Hindley-Milner typechecking, bringing its advantages from the lab to the production software engineering environment.

Comments and suggestions to: