News for hackers. Stuff that matters.
Re:Clojure to die for by lelf on Tuesday March 11, 2014 @08:04AM (#7378709)
Well, there is no such simple interoperability with java from haskell, that's for sure. But otherwise…

  user> (:key nil)
  nil
Mmmm, I'm not certain I particularly want this

  user> (nil :key)
  CompilerException java.lang.IllegalArgumentException: Can't call nil
RUN!
Re:Clojure to die for by _halgari on Tuesday March 11, 2014 @11:41AM (#7379897)
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.
Re:Clojure to die for by Tuna-Fish on Tuesday March 11, 2014 @01:22PM (#7380709)
If you use clojure.typed, I think the second example would give you a compile-time type error.
Re:Clojure to die for by tobik on Tuesday March 11, 2014 @01:55PM (#7380934)
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:

  user> (let [e nil] (e :key))

  NullPointerException