That was my first thought too, but (hash nil) is zero. So it doesn't seem like it "should" be caused by that problem. I'm not familiar enough with the internals of clojure.core to follow all of the stuff going on in (source case), but it seems to be using (hash x) rather than (. x hashCode). And (min-hash) does the same, so at first glance it looks like there is no NPE caused by hashing. On the other hand, I can't see what else is causing an NPE, but maybe someone more experienced can point it out, or tell me why I'm wrong in concluding that it's not hashing that's at fault.
On Aug 30, 5:12 pm, Stuart Sierra <the.stuart.sie...@gmail.com> wrote: > "case" does constant-time dispatch using the hash codes of the test > values. Since nil is Java null, it doesn't have a hash code, so > "case" can't handle it. > > I wouldn't call it a bug, but there is work to be done on extending > "case" to edge cases like this. > > -S > > On Aug 30, 5:07 pm, Paul Mooser <taron...@gmail.com> wrote: > > > I was surprised today when using "nil" as the test value for one of > > the clauses of the new 1.2 "case" statement that it results in an NPE. > > Is this a bug, or intended behavior? > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en