www.delorie.com/gnu/docs/kawa/kawa_76.html   search  
 
Buy GNU books!


Kawa, the Java-based Scheme system

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11.3 Low-level Method invocation

The following lower-level primitives require you to specify the parameter and return types explicitly. Type specifications are currently required to be string literals or one of the standard types (see section 9.1 Standard Types).

Syntax: primitive-constructor class (argtype ...)
Returns a new anonymous procedure, which when called will create a new object of the specified class, and will then call the constructor matching the specified argument types.

Syntax: primitive-virtual-method class method rtype (argtype ...)
Returns a new anonymous procedure, which when called will invoke the instance method whose name is the string method in the class whose name is class.

Syntax: primitive-static-method class method rtype (argtype ...)
Returns a new anonymous procedure, which when called will invoke the static method whose name is the string method in the class whose name is class.

Syntax: primitive-interface-method interface method rtype (argtype ...)
Returns a new anonymous procedure, which when called will invoke the matching method from the interface whose name is interface.

The macros return procedure values, just like lambda. If the macros are used directly as the procedure of a procedure call, then kawa can inline the correct bytecodes to call the specified methods. (Note also that neither macro checks that there really is a method that matches the specification.) Otherwise, the Java reflection facility is used.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003