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

It's more cognitive load to write a validation for every parameter because you can't rely on your fellow dev knowing it's not good to pass a string where you want a boolean.


I think you misunderstood the article and my comment: this is about introducing new types, not about typing or not typing your function arguments.


But new types are wonderful! They can be used to prevent you from adding speed and and fuel left. Yes, both speed and fuel left are floats, but adding them will only produce nonsense.


Which is an altogether different discussion: the OP focused on compound types, and not on type "aliases" and their benefits.

Most languages and their typing systems would still allow adding speed and fuel-left if you only aliases them, so you are likely going to need to sacrifice ergonomics by wrapping them in a compound type instead.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: