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: Generating arbitrary Java classes at run time with Kawa


On 11/08/2012 01:24 PM, Per Bothner wrote:
On 11/08/2012 01:11 PM, Vladimir Tsichevski wrote:
Hi all,

is is possible to use Kawa to generate Java classes based on run time
information (not known at compile time)?

The problem is that define-simple-class is a syntax, not a function.

I know, at run time I could convert my Java class metadata to a scheme
file with all define-simple-class expressions, and then compile the
file, but I'm looking for more elegant solution.

You should be able to use the eval function.

You might also consider using the object syntax, rather than define-simple-class,
assuming a singleton class (single-instance) is enough:
http://www.gnu.org/software/kawa/Anonymous-classes.html


(define my-object (eval `(object (,base-class) ,@(calculated-stuff))))
--
	--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]