Hi everyone,

I came back to a project of mine after a couple of months only to be surprised by some cryptic exception! Imagine a 2d vector:

(def coords [[0 0] [0 1] [1 0]  [1 1]]) ;;vector of vectors of longs

;;but let's try ints which are cached:

(def coords
(mapv #(apply vector-of :int %) [[0 0] [0 1] [1 0] [1 1]])) ;;vector of vectors of ints


everything seems great right? well, now my namespaces don't even compile! This is my representation of the 'board' in a game which means that I'm only reading from this vector nothing else! I am getting CompilerException java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: clojure.core$reify__6184@1eb42164, compiling:(Clondie24/games/chess.clj:244:1) where line 244 is just a 'defn' with its argument vector...as soon as I comment out the conversion to unboxed int primitives everything works again! doing (pst) does not help at all! Look at this:

user=> (pst)
CompilerException java.lang.RuntimeException: Can't embed object in code, maybe print-dup not defined: clojure.core$reify__6186@61c28cfb, compiling:(Clondie24/games/chess.clj:244:1)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6566)
    clojure.lang.Compiler.analyze (Compiler.java:6360)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6547)
    clojure.lang.Compiler.analyze (Compiler.java:6360)
    clojure.lang.Compiler.access$100 (Compiler.java:37)
    clojure.lang.Compiler$DefExpr$Parser.parse (Compiler.java:528)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6559)
    clojure.lang.Compiler.analyze (Compiler.java:6360)
    clojure.lang.Compiler.analyze (Compiler.java:6321)
    clojure.lang.Compiler.eval (Compiler.java:6622)
    clojure.lang.Compiler.load (Compiler.java:7062)
    clojure.lang.RT.loadResourceScript (RT.java:361)
Caused by:
RuntimeException Can't embed object in code, maybe print-dup not defined: clojure.core$reify__6186@61c28cfb
    clojure.lang.Util.runtimeException (Util.java:219)
    clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4570)
    clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4496)
clojure.lang.Compiler$ObjExpr.emitListAsObjectArray (Compiler.java:4392)
    clojure.lang.Compiler$ObjExpr.emitValue (Compiler.java:4529)
    clojure.lang.Compiler$ObjExpr.emitConstants (Compiler.java:4609)
    clojure.lang.Compiler$ObjExpr.compile (Compiler.java:4072)
    clojure.lang.Compiler$FnExpr.parse (Compiler.java:3808)
    clojure.lang.Compiler.analyzeSeq (Compiler.java:6557)
    clojure.lang.Compiler.analyze (Compiler.java:6360)
nil

this is clearly not my code! everything is clojure.lang.Compiler related!
what is happening exactly? can anyone explain? I'm not doing anything 'weird' in the function reported in the exception just reading the vector.

Jim





--
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

Reply via email to