use macros to generate java calls
Per Bothner
per@bothner.com
Mon Dec 5 15:09:00 GMT 2011
On 12/05/2011 12:30 AM, RÄzvan Rotaru wrote:
> Hi,
>
> I'm trying to use macros to generate java calls, and have been
> strugling with this all weekend, but with no success. So, I'd like to
> ask for some help from more experienced schemers:
>
> The macro should work like this:
>
> (create-object obj-type 'id1 arg1 'id2 arg2 ...)
>
> =>
>
> (obj-type) ;instantiation
> (*:setId1 arg1)
> (*:setId2 arg2)
> ...
>
>
> Is this possible with kawa? Any hints how to achieve this? The biggest
> challenge will probably be to transform 'id-foo in setIdFoo.
Rather than write your own macro, I suggest using the builtin facilities:
http://www.gnu.org/software/kawa/Allocating-objects.html
That makes use of keywords, changing your example to:
(obj-type id1: arg1 id2: arg2 ...)
--
--Per Bothner
per@bothner.com http://per.bothner.com/
More information about the Kawa
mailing list