Thanks, Marko! I'd count this as a sort of bug though... at least in
terms of consistency, since it breaks expected behaviour as
established by other common array c'tor functions:

(int-array [1 2 3]) => ok
(long-array [1 2 3]) => ok
(float-array [1 2 3]) => ok
(double-array [1 2 3]) => ok
(byte-array [1 2 3]) => fail
(short-array [1 2 3]) => fail
(char-array [1 2 3]) => fail, but bearable since you'd use shorts
anyway if you specify chars as numbers

I had a look at clojure.lang.Numbers.java and found a fix for both
bytes & shorts:

Whereas all the working array c'tors functions are using this pattern:

array[i] = ((Number)s.first()).intValue();

... the byte-array & short-array versions attempt to cast the sequence
items directly, i.e.

array[i] = (Byte)s.first();

Changing this to the first pattern (via Number) fixes the issue and
I'll submit a patch for this...

Hth! K.
--
Karsten Schmidt
http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk

On 2 March 2013 18:43, Marko Topolnik <marko.topol...@gmail.com> wrote:
> On Saturday, March 2, 2013 6:22:51 PM UTC+1, Karsten Schmidt wrote:
>>
>>
>> Is that a bug or can someone please explain why bytes seem to require
>> special treatment in Clojure?
>
>
> Calling it a bug wouldn't be entirely fair since it's a missing feature. I'd
> say this is filable as an enhancement request.
>
> -Marko
>
> --
> --
> 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.
>
>

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