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]

Calling keyed functions from Java


A surprise concerning calling keyworded functions from Java. I define (in
a static module):
   
  (define (make-pair #!key low high) <list>
    (write low) (newline) (write high) (newline)
    (list low high)
  )

and try calling it from Java:

  public class testtest  
  {
    public static void main( String[] argv )
    {
      kawa.standard.Scheme.registerEnvironment();
      Object[] args1 = { "A", "B" };
      Object result = test.makePair$V( args1 );
    }
  }

only to find that the arguments are ignored, the 'write's displaying two
#f's. Called from Kawa, the function works as intended.

In a function call, when does Kawa look for the keys? Is it (as I thought,
because otherwise type-checking wouldn't be easy) when compiling the call,
so that the resulting formal parameter list is just for the arguments
themselves, without keys? Or does it scan the argument list when executing
the call? If the latter, I need to pass the keys in the actual parameter
array to Java - how do I do that?

I don't make a habit of defining functions as keyed if they're to be
called only from Java, but I do have a few which are called mostly from
Kawa, but need once or twice to be called from Java.

Jocelyn Paine
http://www.ifs.org.uk/~popx/
+44 (0)7768 534 091 




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