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

What programming languages need is dimensional analysis. The fact that I can make variables like

Const km = 1 Const velocity = 11

And do km + velocity = 12 is all kinds of silly.



What programming languages need is linguistic analysis. The fact that I can make variables like

Const true = False Const false = True

And do if (true) "won't happen" else if (false) "will happen" is all kinds of silly.


That exists, it is called a nominal type system, while in your example the language has a structural type system.

Edit: Assuming your example is even statically typed.




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

Search: