Node:Low-level Method invocation,
Next:Low-level Field operations,
Previous:Array operations,
Up:Low-level functions
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 Standard Types).
primitive-constructor class (argtype ...)
|
Syntax |
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.
|
primitive-virtual-method class method rtype (argtype ...)
|
Syntax |
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.
|
primitive-static-method class method rtype (argtype ...)
|
Syntax |
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.
|
primitive-interface-method interface method rtype (argtype ...)
|
Syntax |
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.