Problem with invoke with method determined at runtime

Per Bothner per@bothner.com
Sat Jan 7 21:49:00 GMT 2012


On 01/07/2012 12:37 PM, Bill Robinson wrote:
> Aha! Thanks very much!
>
> So what I'm after really is:
>
> test.scm containing:
>
> (define-simple-class TestClass ()
>    ((test (arg :: int)) :: void
>     (java.lang.System:out:format "test %d\n" arg)))
>
> (let ((t ::TestClass (TestClass))
>        (method 'test))
>    (invoke t 'test 1)
>    (invoke t method 2))

Thanks!  I checked this testcase in as testsuite/reflect1.scm.
Can't have too many tests :-)

I did change:
        (method 'test))
to
       (method (string-copy "test")))
to reduce the risk that (hypothetical future) compiler optimizations
might change it to compile-time reflection instead.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/



More information about the Kawa mailing list