Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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.


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.


Pascal had subrange types, which were quite nice in that regard. Although I don't remember using them that much.


e.g. money is badly represented as float.

just my $0.0200000000001 on that topic.


and what about "floating" currency?

just my 0.00603698 KWD Kuwaiti Dinars on that topic




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: