It just occurred to me to try this:

(defn foo [#^"[B" bytes] (String. bytes))

Which seems to work.  So I answered my own question.
-Stuart


On Sep 19, 12:11 pm, Stuart Sierra <[EMAIL PROTECTED]>
wrote:
> Hi,
> I wanted to remove some reflection by adding type tags.  One of the
> types I had to tag was an array of primitives (Java byte[], to be
> exact).  I can get the class like this:
>
> user=> (def byte-array-type (class (make-array Byte/TYPE 0)))
> #'user/byte-array-type
> user=> byte-array-type
> [B
>
> But I can't use that in a type tag:
>
> user=> (defn foo [#^byte-array-type bytes] (String. bytes))
> java.lang.IllegalArgumentException: Unable to resolve classname: byte-
> array-type (NO_SOURCE_FILE:49)
>
> Is there a way to do this?  Thanks,
> -Stuart Sierra
--~--~---------~--~----~------------~-------~--~----~
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
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to