Re:The Ergonomics of Type Checking (2016)
by z3t4 on Saturday October 28, 2017 @06:32PM
(#15577019)
in JavaScript I pepper each function with if(...) throw, eg the program will throw if something is wrong. Doing this catches a lot of errors and bad state. - Without having to babysit a compiler (Typescript) and I can enjoy all the dynamic features. Sometimes I miss the type annotation as documentation, but then I just rename the variable to make it more clear what it is and does.
[ Parent
| on HN ]
Re:The Ergonomics of Type Checking (2016)
by bitwalker on Saturday October 28, 2017 @06:57PM
(#15577112)
Instead of "babysitting" your compiler, you're "babysitting" your application at runtime - I fail to see the difference.
Good point. Think of it as hand-holding your peers instead of hand-holding the compiler. if(x==y) throw "friendly error" // avoids eternal loop ...
The compiler doesn't care if you get an eternal loop at runtime, and static types wont prevent it.