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

I will start by saying I agree with you, and also that many functional languages bring types to the next level, f# included.

But I will also say this is possible in other languages to some degree with some level of boiler plate.

For example, in java I can do similar. Instead of using float, wrap that in a class called kilometer and use that instead. Then define the api around it as needed (equals, compare, value, etc). Even this small thing I think is really important, and is helpful instead of using primitives or strings. Make email instead of string, dollar instead of just big decimal, etc.



If it's hard to use people tend to avoid using it. Also the wrapped int would have to be private to avoid people to use it anyway.




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

Search: