This is the mail archive of the kawa@sources.redhat.com 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]

Re: Exception when calling fn. using for-each in Java


Jocelyn Paine <popx@pop3.ifs.org.uk> writes:

> Now, this is NOT because I've passed a null parameter to pairToVector:
> the same exception also happens if I construct a Kawa list and pass that.
> By compiling various Kawa functions and calling from Java, I've discovered
> that it's the presence of a for-each in the function that provokes this
> error, whether or not it is acting on objects passed from Java. But such
> functions work OK when called from Kawa. 
> 
> Tentative hypothesis: when Kawa compiles a 'for-each', it generates some 
> kind of initialisation code which needs to be executed when the function 
> is called for the first time. This is automatic when calling from Kawa, 
> but not from Java. Any suggestions?

It has nothing to do with for-each per se.  However, you need a
Scheme environment for the Scheme code it work.  You should add:

      kawa.standard.Scheme.registerEnvironment();

to the start of main.  This is documented in the Kawa manual,
though it may be easy to overlook, because of lack of examples.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/~per/

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