Welcome! Please see the About page for a little more info on how this works.

0 votes
ago in ClojureCLR by

As I was working on the magic compiler (the compiler to build to il2cpp in Unity), I noticed i was not having the same behaviour for datafy than clojureCLR.

In fact, we found a small JVM-parity bug in clojure.datafy/datafy, in how :clojure.datafy/class is set in ClojureCLR:

;; JVM clojure (datafy.clj) : fully qualified name, e.g. my.ns.CombinationB
(vary-meta v assoc ::obj x ::class (-> x class .getName symbol))

;; MAGIC's port : .FullName is the CLR equivalent of .getName, so same result
(vary-meta v assoc ::obj x ::class (-> x class .FullName symbol))

;; ClojureCLR (Clojure.Source/clojure/datafy.clj) : .Name is only the short name,
;; e.g. CombinationB, so the namespace is lost
(vary-meta v assoc ::obj x ::class (-> x class .Name symbol))

This breaks code that resolves the class back from the metadata (e.g. reconstructing records from datafied data ). The fix is small change: .Name.FullName.

Please log in or register to answer this question.

...