4 ms·
I take issue with the single-number-type thing. This guy is conflating two different reasons/ways to divide up number types - for transparency w.r.t. machine (o
by kmicklas 12y ago
I take issue with the single-number-type thing. This guy is conflating two different reasons/ways to divide up number types - for transparency w.r.t. machine (optimization) and by conceptual types (integer vs natural number vs fractional, etc.). The first arguably doesn't belong in a high level language. The second arguably is _exactly_ what a truly high level language should have.
- sink 12y agoI 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 12y agoe.g. money is badly represented as float. just my $0.0200000000001 on that topic.
- mmphosis 12y agoand what about "floating" currency? just my 0.00603698 KWD Kuwaiti Dinars on that topic
- dagw 12y 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 12y agoPascal had subrange types, which were quite nice in that regard. Although I don't remember using them that much.