This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
applicability of instance? on Java array types?
- From: Chris Dean <ctdean at sokitomi dot com>
- To: "Hoehle, Joerg-Cyril" <Joerg-Cyril dot Hoehle at t-systems dot com>
- Cc: kawa at sources dot redhat dot com
- Date: Thu, 04 Dec 2003 09:20:26 -0800
- Subject: applicability of instance? on Java array types?
- References: <9F8582E37B2EE5498E76392AEDDCD3FE08580511@G8PQD.blf01.telekom.de>
> Isn't <byte[]> also a primitive type?
No. <byte> is primitive, <byte[]> is an array (ok, it's a primitive
array) and all arrays are objects.
So, (instance? x <byte[]>) will work.
In my mind this is more a question of how the target platform functions
(i.e. the JVM). Some things in Kawa are the way they are because that's
just how the JVM works. In this example, instance? compiles down to the
JVM instruction 193 "instanaceof" and this instruction has specific
semantics:
http://java.sun.com/docs/books/vmspec/2nd-edition/html/Instructions2.doc6.html#instanceof
Regards,
Chris Dean