3 ms·
Aside: Instead of hungarian notation in Rust we do this[0]. Free compile time unit safety :) [0]: https://blog.mozilla.org/research/2014/06/23/static-checking-
by Manishearth 12y ago
Aside: Instead of hungarian notation in Rust we do this[0]. Free compile time unit safety :)
[0]: https://blog.mozilla.org/research/2014/06/23/static-checking-of-units-in-servo/ https://blog.mozilla.org/research/2014/06/23/static-checking...
- NateDad 12y agoNote, you can do this easily in Go, too: type Kelvin int type Celcius int func SetReactorTemp(temp Celcius) {} func GetOperatingTemp() Kelvin {} temp := GetOperatingTemp() SetReactorTemp(temp) // compile error
- lmm 12y agoYou can, but it quickly becomes infuriating in a language without generics, because you have to repeat any data structure that you want to potentially contain different kinds of temperatures.
- NateDad 12y agoI won't get into it on generics other than to say, in my 2 years of full time development in Go, not having them has not been a big deal.... and no I don't use type unsafe code everywhere either.