On Jul 29, 6:09 pm, Jason Wolfe <jawo...@berkeley.edu> wrote:
> Is this a bug?
>
> user> (eval `(make-array ~Byte/TYPE 2))
> ; Evaluation aborted. (ExceptionInInitializerError)
>
> Compare:
>
> user> (eval `(make-array ~Byte 2))
> #<Byte[] [Ljava.lang.Byte;@26fcfd5c>
>
> user> (eval `(make-array Byte/TYPE 2))
> #<byte[] [...@1f0feb6e>
>
> user> (make-array (eval Byte/TYPE) 2)
> #<byte[] [...@7ce49289>
>
> If not, can someone please help me understand what's going on here?
>

Yes, currently you cannot embed constants of primitive Class types.
This arises from an asymmetry in Java:

user=> (.getName Byte)
"java.lang.Byte"

user=> (Class/forName "java.lang.Byte")
java.lang.Byte

user=> (.getName Byte/TYPE)
"byte"

user=> (Class/forName "byte")
java.lang.ClassNotFoundException: byte (NO_SOURCE_FILE:0)

A patch to support reading, and embedded constants, of primitive Class
objects would be welcome. The current print-dup support won't do it.

If anyone is interested in contributing this patch please bring it up
on the clojure-dev group before proceeding and I can give you some
guidance as to what needs to be changed.

Thanks for the report,

Rich

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