Generating arbitrary Java classes at run time with Kawa
Per Bothner
per@bothner.com
Thu Nov 8 21:37:00 GMT 2012
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/
More information about the Kawa
mailing list