Created
September 24, 2014 18:43
-
-
Save luxbock/e0a6246d01f5689b5524 to your computer and use it in GitHub Desktop.
data-readers weirdness
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (deftype Bar [a] | |
| Object | |
| (equals [self other] true) | |
| (toString [_] (str a))) | |
| (defn barme [a] (->Bar a)) | |
| (set! *data-readers* {'bar myns/barme}) | |
| ;; #bar :foo => nil | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (deftype Bar [a] | |
| Object | |
| (equals [self other] false) | |
| (toString [_] (str a))) | |
| ;; #bar :foo => #<Bar :foo> | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (deftype Bar [a] | |
| Object | |
| (equals [self other] (= self other)) | |
| (toString [_] (str a))) | |
| ;; #bar :foo | |
| ;; => CompilerException java.lang.StackOverflowError, compiling:(/private/var/folders/j2/zvt92c1s39d_0kdmhrhbgtkm0000gn/T/form-init1859776228210896770.clj:1:5200) | |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| (deftype Bar [a] | |
| Object | |
| (equals [self other] (= (.a self) (.a other))) | |
| (toString [_] (str a))) | |
| ;; #bar :foo | |
| ;; => CompilerException java.lang.IllegalArgumentException: No matching field found: a for class clojure.lang.Symbol, compiling:(/private/var/folders/j2/zvt92c1s39d_0kdmhrhbgtkm0000gn/T/form-init1859776228210896770.clj:1:5200) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment