3 ms·
Your second point is actually a feature, and is equivalent to structural pattern matching in languages with algebraic types not allowing you to have unspecified
by scott_s 17y ago
Your second point is actually a feature, and is equivalent to structural pattern matching in languages with algebraic types not allowing you to have unspecified cases.
- jrockway 17y agoI think he was advertising this as a feature. Failing to compile is much better than hitting your "this can't happen" conditional at runtime.
- scott_s 17y agoYou're right, I didn't understand his intentions.
- wlievens 17y agoAbsolutely. One of the advantages of static typing (NOT starting a type war here, oh gods) is that you can transform error conditions from the run-time to the compile-time world. Earlier failure = cheaper failure, so this is great. I try to take this as far as I can. For instance, when writing Servlet code in Java, I define all my request parameter names in an enum, so that I can never misspell any lest the compiler tell me.