3 ms·
I agree. Just think of how often what you really want to express in your program is a function that takes a Positive Integer, and any other type of number is si
by sink 11y ago
I agree. Just think of how often what you really want to express in your program is a function that takes a Positive Integer, and any other type of number is simply wrong.
- kephra 11y agoe.g. money is badly represented as float. just my $0.0200000000001 on that topic.
- mmphosis 11y agoand what about "floating" currency? just my 0.00603698 KWD Kuwaiti Dinars on that topic
- dagw 11y agoI'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 11y agoPascal had subrange types, which were quite nice in that regard. Although I don't remember using them that much.