This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: why (apply + (int[] 1 2 3)) won't work ?
- From: Jamison Hope <jrh at theptrgroup dot com>
- To: "kawa at sourceware dot org list" <kawa at sourceware dot org>
- Date: Mon, 10 Jun 2013 10:34:11 -0400
- Subject: Re: why (apply + (int[] 1 2 3)) won't work ?
- References: <CAKZUWfi_eL+x==736dpU6QdBLpHXHk8TaXYzWDmPheYXb0DzAw at mail dot gmail dot com> <51B42C0E dot 8080502 at bothner dot com> <90D06C3D-E227-4E22-9C8D-FEFA4612A9C9 at theptrgroup dot com> <51B4DF8B dot 70904 at bothner dot com>
On Jun 9, 2013, at 4:03 PM, Per Bothner <per@bothner.com> wrote:
>> Primitive arrays are not supported at all, though, since they are
>> disjoint from Object[]. I'm sure a patch would be welcome to allow
>> for them, but it'll be a hassle since you have to handle each
>> primitive type separately (and there are 8 of them).
>
> Luckily, we can delegate this hassle to java.lang.reflect.Array.
> I just checked in a patch (along with some tests) to do that.
Oh, right. I remembered its getBoolean(), getByte(), etc., but had
forgotten about the auto-boxing get().
That works, as long as it's deemed acceptable for the object
representations to be the standard Java number classes and not the
gnu.math types. I suppose that already ought to be the case any
time that we'd be passing a primitive array to apply and expecting
it to do the right thing.
--
Jamison Hope
The PTR Group
www.theptrgroup.com