Fixed in master thanks to Michal Marczyk! David
On Tue, Jan 6, 2015 at 3:05 AM, Fluid Dynamics <a2093...@trbvm.com> wrote: > On Monday, January 5, 2015 2:27:03 PM UTC-5, Feng Xue wrote: >> >> These days, I was trying to utilize function hash in >> clojure/clojurescript to generate unique id, but it turns out this function >> has very strange behaviour to empty vector parsed from read-string in >> cljs with in clj. >> >> In clojure, hash function return -2017569654 for empty vector and the >> one parsed from read-string >> >> user=> (hash [])-2017569654 >> user=> (hash (read-string "[]"))-2017569654 >> >> However, in cljs, (hash []) returns surprisingly 0. And [] are also >> equal to (read-string "[]"). >> >> cljs.user=> (hash (cljs.reader/read-string "[]"))-2017569654 >> >> cljs.user=> (hash [])0 >> >> cljs.user=> (= [] (cljs.reader/read-string "[]")) >> true >> >> Does any one know the reason of it and how to solve it in cljs? >> > Since objects that compare equal should never have different hashes, this > is indubitably a bug. > > > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.