3 ms·
Having programmed both in Haskell and Java, my experience is very different. In Java you have to "please the compiler" all of the time. Most of the types you a
by dirkt 7y ago
Having programmed both in Haskell and Java, my experience is very different.
In Java you have to "please the compiler" all of the time. Most of the types you add don't help in finding bugs. The type system is not expressive enough for real general types, because subtyping gets in the way.
In Haskell, the experience is very different: Writing down a general type first guides you in writing the code. Or, conversely, writing down the code first and then looking at the inferred type sometimes gives you clues to modify your code to make it better. The Haskell syntax is more terse, so a lot more trivial errors (typos etc.) are caught by the type checker. And the type checker really shines when refactoring code.
And my code is actually not "bug-aversive", I do make a lot of trivial mistakes all of the time. And I'm glad when the type checker catches them.
- jddj 7y agoAnd my code is actually not "bug-aversive", I do make a lot of trivial mistakes all of the time. And I'm glad when the type checker catches them. I'm in this camp too. I love strong static types because I know I'm not particularly obsessive about fine details and can sometimes be sloppy in that respect. Compilers pick up the slack where my attention to detail falls short.
- hyperpallium 7y agoI make a lot of silly mistakes too. But because I understand the code (I'm careful there, bug-aversive), the cause is (almost always) instantly obvious. Though this undermines the thesis.