As many are saying it's a pragmatic choice. And it allows you to do stuff like this:
(:foo (:bar {}))
Without throwing a NPE. Which is what I want 99.9% of the time. As someone who codes in Clojure close to 10 hours a day, I rarely see a problem like you describe.
While true, the second example already gives you a compile-time error in normal Clojure (note the CompilerException). It never compiled and was never evaluated. This on the other hand compiles and is likely what the OP wanted to show:
Comments
Well, there is no such simple interoperability with java from haskell, that's for sure. But otherwise…
Mmmm, I'm not certain I particularly want this RUN!As many are saying it's a pragmatic choice. And it allows you to do stuff like this:
Without throwing a NPE. Which is what I want 99.9% of the time. As someone who codes in Clojure close to 10 hours a day, I rarely see a problem like you describe.If you use clojure.typed, I think the second example would give you a compile-time type error.
While true, the second example already gives you a compile-time error in normal Clojure (note the CompilerException). It never compiled and was never evaluated. This on the other hand compiles and is likely what the OP wanted to show: