This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: some questions using callbacks to java
- To: "Paul R. Potts" <potts at umich dot edu>
- Subject: Re: some questions using callbacks to java
- From: Per Bothner <per at bothner dot com>
- Date: 24 Jul 2000 14:00:14 -0700
- Cc: <kawa at sourceware dot cygnus dot com>
- References: <B5A21CCD.19795%potts@umich.edu>
"Paul R. Potts" <potts@umich.edu> writes:
> (begin
> (invoke debug-callbacks 'print "script point 1")
> (invoke parameter-callbacks 'test_bind "patient")
> (invoke debug-callbacks 'print patient)
> )
>
> when i evaluate the kawa body i get
>
> <string>:1:332: warning - no method `print' in java.lang.Object
> <string>:1:381: warning - no method `test_bind' in java.lang.Object
> <string>:1:427: warning - no method `print' in java.lang.Object
>
> is there a way to avoid these warnings going to stdout?
I could disable these warning with some switch, I suppose. However, the
warning means that the compiler is forced to generate code to look up
the method at run-time. I haven't timed it, but I would not be surprised
is doing that is *100 times* slower than if the compiler can find the
method.
The prferred ay to avoid the warnings is to use declarations, assuming
debug-callbacks etc are lexicall bound. If not you can put in an
explicit cast:
(invoke (as <java.util.Date> my-date) 'setDate cur-date)
I don't know how well this would work with inner classes.
> the first callback works, then the test_bind fires. it appears to execute
> ok, but then when executing the next callback i get
>
> Unbound Symbol exception: Unbound symbol patient
"patient" does not evaluate to a Java String - it's a Scheme string.
Use 'patient instead.
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/