Hacker News new | past | comments | ask | show | jobs | submit login

> The argument goes that a True False value will "mean" different things in a context

Well, it is the same with numbers anytime they mean something in the real world. One would have to add "unit types" to numbers and check that x + y causes a type error when a "nr. of humans" is added to a "nr. of rainy days", to give an example. If that is represented by adding two integers there won't be an error. In software comparing apples and oranges works fine as long as you use numbers...




Database generated IDs are a great example. We often use integers because it is convenient - but there's no reason you should be able to add two together.


Isn't that the whole point of nominal type systems that you shouldn't be "comparing apples and oranges"


Yeah, but type systems are not fool proof. eg: I've seen plenty of Java code which blindly passes String objects around that eventually get parsed into json/int/long/etc. At that point, the type system has been silently circumvented.

"Nothing is foolproof given a sufficiently talented fool."




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: