4 ms·
Different techniques are useful for different problems. Sometimes you really want a powerful type system: it makes invariants for safety, concision, and speed a
by aphyr 14y ago
Different techniques are useful for different problems. Sometimes you really want a powerful type system: it makes invariants for safety, concision, and speed available that you can't get any other way. Other times you want a more dynamic type system: especially where you don't really know the full shape of the problem yet. This is a choice you have to make, as a language: where on the type continuum do you fall? It's partly technical, partly cultural. When done well, it pervades the language offering tremendous power--but it is a choice.
In many other respects, Haskell and Clojure are ideologically similar. Both emphasize immutability, referential transparency, higher-order functional programming, and laziness. Clojure chooses to layer this on top of a mutable core; Haskell uses monadic combinators. Again, there's a difference of perspective. Haskell's technical emphasis on purity makes powerful invariants available to the compiler, but requires some serious type acrobatics for concurrent stateful operations. Clojure gains the ability to drop to mutability in a simpler way, but places the burden on the programmer to keep track of side effects: relying on culture to maintain sane guarantees.