42 points · by prakash · 17y ago · 13 comments
For example, a particular variable's typed might be refined over time in stages like this.
1. dynamically typed
2. number
3. floating-point number
4. floating-point number between 0.0 - 100.0
5. floating-point number between 0.0 - 100.0, with a minimum of 40 bits in the fractional part
6. floating-point number between 0.0 - 100.0, with a minimum of 40 bits in the fractional part, and tell the execution environment to optimize for memory use instead of performance
The languages in use today can cover parts of that spectrum, but nothing allows the whole range.
http://www.cs.colorado.edu/~siek/pubs/pubs/2006/siek06:_grad...
If I'm adding 3.5 oz of OJ to 6.7 oz of vodka, that's either a programming mistake or a strong drink (represented programatically). (Yes, the correct answer depends on context.) A type system that helps me in that situation is worth something.
A type system that only addresses representation and range of primitive values can't even begin to help in that situation.
Yes, units are a partial solution. (They also reduce programmer work - you can add feet to furlongs and get something sensible.)
"An experiment is worth a thousand opinions."
I'm into OCaml but I think he's wrong to recommend it so highly in this specific niche - OCaml's namespacing mechanism is weak compared to C++ and Java's for example. Probably the most serious commercial users of OCaml are Jane Street Capital, and their Yaron Minsky has complained about this.
I can read Perl programs that are more than 100 lines long. It is all a matter of learning Perl first. The same applies to every other programming language.