JVM bytecode can't contain data-structures, only code. If you eval
something or embed it in macro output the clojure compiler needs to be
able to output code that reconstructs an equal object. There are some
types that it can't do that for.

user=> (def x)
#'user/x
user=> x
#<Unbound Unbound: #'user/x>
user=> (eval x)
#<Unbound Unbound: #'user/x>
user=> (eval [x])

CompilerException java.lang.RuntimeException: Can't embed object in
code, maybe print-dup not defined: Unbound: #'user/x,
compiling:(NO_SOURCE_PATH:1:1)

The compiler seems to be complaining that print-dup is not defined at
that the point that it is used. I *would* suspect some subtle
read-time/compile-time distinction in when vars are defined inside a
single form but I can't reproduce your problem:

user=> (binding [*foo* nil]
  #_=>   (def e 1)
  #_=>   `e)
user/e
user=> (binding [*foo* nil]
  #_=>   (def x 1)
  #_=>   x)
1
user=> (binding [*foo* nil]
  #_=>   (def y 1)
  #_=>   (eval `y))
1
user=> (binding [*foo* nil]
  #_=>   (def z 1)
  #_=>   ^{:tag `z} [])
[]
user=> (binding [*foo* nil]
  #_=>   (def q 1)
  #_=>   ^{:tag #=(eval `q)} [])
[]
user=> (binding [*foo* nil]
  #_=>   (defn bar [])
  #_=>   (bar))
nil

-- 
-- 
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/groups/opt_out.

Reply via email to