3 ms·
Type systems that are concerned with representation and range of primitive values aren't very useful. Replacing representation/structure with type names doesn'
by anamax 17y ago
Type systems that are concerned with representation and range of primitive values aren't very useful. Replacing representation/structure with type names doesn't improve things.
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.)
- nradov 17y agoAgreed. I just used that floating-point variable as a simple example. It would certainly be useful to have some concept of units built into the language. I'm actually working on handling units in Java right now, as part of a larger library for healthcare data. http://www.hl7.org/v3ballot/html/infrastructure/datatypes/datatypes.htm#prop-PQ.unit http://www.hl7.org/v3ballot/html/infrastructure/datatypes/da...
- jongraehl 17y agoGood point. However, if "list of no fewer than 1 strings" is an interesting type, then why can't "integer no smaller than 1" be an interesting type?