This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: query type of an instance
Luis Casillas wrote:
You can just call the class() method on objects. Somewhere near the top
of your source file:
(define-namespace Object <java.lang.Object>)
... and then, when you want the class of foo:
(Object:class foo)
You mean of course the getClass method:
(Object:getClass foo)
You can also just write:
(foo:getClass)
However, that requires that foo not be a Type or Class
name, since in that case Kawa looks for a static method.
There is a "class" property, because Kawa implements
the JavaBeans conventions that a field "bar" is
equivalent to a method "getBar".
I.e. (as Yaroslav found out):
foo:class
> Is there a function analogous to macro-expand in Kawa?
Not really. Syntax hygiene makes that somewhat tricky.
Luis's macros seems useful as a start.
If I had time I'd like to re-write Kawa's macro-expander
to make it fully compatible with R6RS, probably based on
André van Tonder's code.
--
--Per Bothner
per@bothner.com http://per.bothner.com/