This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: use macros to generate java calls


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]