Re: RuntimeException: Can't embed object in code, maybe print-dup not defined

2011-03-12 Thread Ken Wesson
On Sat, Mar 12, 2011 at 10:44 AM, Stuart Sierra wrote: >> Yes, but "create a static final member in the class I'm generating >> bytecode for, stuff the object in that static member, and embed a >> reference to the static member here" seems like a sensible thing for >> it to do. > > That's easy for

Re: RuntimeException: Can't embed object in code, maybe print-dup not defined

2011-03-12 Thread Stuart Sierra
> > Yes, but "create a static final member in the class I'm generating > bytecode for, stuff the object in that static member, and embed a > reference to the static member here" seems like a sensible thing for > it to do. > That's easy for simple types like java.util.Date, but how could it work f

Re: RuntimeException: Can't embed object in code, maybe print-dup not defined

2011-03-11 Thread Ken Wesson
On Fri, Mar 11, 2011 at 11:52 PM, Stuart Sierra wrote: > `eval` invokes the Clojure compiler, which transforms data structures into > Java bytecode.  The Clojure compiler understands Clojure data structures > like lists, vectors, and symbols, plus a few Java types like String and > numbers.  It do

Re: RuntimeException: Can't embed object in code, maybe print-dup not defined

2011-03-11 Thread Ken Wesson
On Fri, Mar 11, 2011 at 11:12 PM, Armando Blancas wrote: > You need to quote the vector so the date will be created inside eval, > instead of having the date go into eval as an element of the > (evaluated) vector. A more interesting question is "why does this error exist in the first place"? Why

Re: RuntimeException: Can't embed object in code, maybe print-dup not defined

2011-03-11 Thread Stuart Sierra
`eval` invokes the Clojure compiler, which transforms data structures into Java bytecode. The Clojure compiler understands Clojure data structures like lists, vectors, and symbols, plus a few Java types like String and numbers. It doesn't know what to do with a java.util.Date. "Can't embed o

Re: RuntimeException: Can't embed object in code, maybe print-dup not defined

2011-03-11 Thread Armando Blancas
You need to quote the vector so the date will be created inside eval, instead of having the date go into eval as an element of the (evaluated) vector. user=> (eval '[(java.util.Date.)]) [#] On Mar 11, 4:37 pm, Jeffrey Schwab wrote: > What does eval'ing a form containing an object reference cause