David,

Issue created: CLJS-1859.

Thank you for your work on ClojureScript.

Cheers,
Juan

On Monday, November 21, 2016 at 6:55:30 PM UTC+1, David Nolen wrote:
> Just a bug. File an issue in JIRA.
> 
> 
> Thanks!
> 
> 
> David
> 
> 
> On Sun, Nov 20, 2016 at 10:58 AM, Juan Facorro <[email protected]> wrote:
> Hi all,
> 
> 
> 
> (This might have been asked before, but I couldn't find anything through a 
> search in the group history or google.)
> 
> 
> 
> First of all, Clojure/ClojureScript are awesome!
> 
> 
> 
> I found the result of comparing a map and a record is different based on the 
> order of the arguments to =:
> 
> 
> 
> To quit, type: :cljs/quit
> 
> cljs.user=> (defrecord R [])
> 
> cljs.user/R
> 
> cljs.user=> (= {} (R.))
> 
> true
> 
> cljs.user=> (= (R.) {})
> 
> false
> 
> 
> 
> I tried the code above with tags r1.7.228, r1.8.34 and 1.9.293.
> 
> 
> 
> Is this expected behavior?
> 
> 
> 
> This seems to be rooted in the fact that when a map is the first argument the 
> function used to make the comparison is the implementation of "equiv" from 
> the map. But when a record is the first argument the implementation used is 
> the one from the record, which checks if the types of both arguments are 
> equal.
> 
> 
> 
> The behavior is Clojure (JVM) is consistent:
> 
> 
> 
> user=> (defrecord R [])
> 
> user.R
> 
> user=> (= {} (R.))
> 
> true
> 
> user=> (= (R.) {})
> 
> false
> 
> 
> 
> I suspect this works consistenly since the implementation of "equiv" in 
> "clojure.lang.APersistentMap" checks for the marker interface 
> "MapEquivalence".
> 
> 
> 
> Kind regards,
> 
> Juan
> 
> 
> 
> --
> 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> 
> ---
> 
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> 
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> 
> To post to this group, send email to [email protected].
> 
> Visit this group at https://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to