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

Yes, though the notation approach is worth following if you cannot use the type system (lang doesn't support it, or incurs unacceptable performance or complexity overhead).

But yeah, zero cost compiler magic is the reason Rust is so good.




I'll be using it in my JavaScript extensively. Very useful in languages with useless type systems.


Are you sure you cannot handle this using conditional types in typescript?


Any typed language can do this, not just Rust ;)




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

Search: