Evlan
Advanced Type System
Last updated at 2006/12/16 15:50:04 PST by Temporal

Fundamentally, a "type" defines some set of values which a variable may hold. The purpose of giving types to variables is to give the compiler more information about what your program is doing. With that information, it is able to optimize code better to produce faster programs. Furthermore, the more information it has, the more easily it can catch errors in your code, reducing bugs.

Most popular languages today use very simple type systems. You can declare a variable as being a number, but you can't specify that it is a number in a certain range, or that it is divisible by some other number, or that it is less than the value stored in another variable. These would be useful properties to be able to specify. For example, if you could specify that an index to an array must be less than the size of the array -- and if the compiler could then check for to make sure this condition is never violated -- then buffer overruns (one of the most common bugs leading to security holes in modern software) would be completely eliminated. (Although many modern languages use bounds checking to prevent buffer overruns, solving the problem through type checking leads to better performance and prevents unexpected exceptions from being thrown at runtime.)

There used to be a few paragraphs of information here which were not really accurrate, and reflected my position on issues before I had done enough research. Woops. To avoid confusion, I'm removing them, but I don't have time to write up a good replacement right now. The short version is that Evlan will implement dependent types. Lots of literature exists on the subject. Also see the draft type system syntax and semantics for some details of Evlan's usage.

Implementation Status: Not implemented. Evlan v0.3.0 uses dynamic types. A draft of the type system's syntax and semantics is available.

References: See the links in the above text.

evlan.org © Copyright 2003-2005 Kenton Varda
Powered by Io Community Manager, Evlan, and FreeBSD