3 ms·
I've often thought you could add that to your type system somehow? Sometimes you want to express that this variable can only take numeric values between 0-1 or
by dagw 12y ago
I've often thought you could add that to your type system somehow? Sometimes you want to express that this variable can only take numeric values between 0-1 or this variable can only take string values with exactly three uppercase ASCII letters. Just like you don't need a special string type to handle three letter strings, you don't need a special number type to handle positive integers, you just need a way to represent subsets in your type systems.
On the other hand I'm decidedly old school and get very uncomfortable around languages that at least don't separate floats from ints.
- ygra 12y agoPascal had subrange types, which were quite nice in that regard. Although I don't remember using them that much.