4 ms·
I can't believe something like this makes it into "production". How could anybody value such an asinine type inference system over compile time? If your compil
by unmaintainable 10y ago
I can't believe something like this makes it into "production". How could anybody value such an asinine type inference system over compile time?
If your compiler needs a constraints solver to determine the type of an expression, it belongs in a science exhibit, not into a real-world toolchain.
Don't try to be clever! Give me a compiler that's predictable, reliable and fast. If that means I have to add some type information here and there, that's just fine!
- eastWestMath 10y agoLots of languages have these features and it works fine. Finding the type of an expression is one of the canonical applications of a constraint solver.
- Jweb_Guru 10y agoA very large percentage of compilers for statically typed languages include algorithms with worst-case exponential time. For instance, the celebrated Hindley Milner type inference algorithm, which is "almost linear" in practice, has worst-case exponential time (the reason it rarely comes up is that programs rarely have deeply-left-nested let bindings). Anyway, type checkers that employ constraint solving can be a lot easier to reason about and extend than alternatives (and give way better error messages, which is probably the second-most-important thing a type checker does).