The following lower-level primitives require you to specify
the parameter and return types explicitly.
You should probably use the functions invoke
and invoke-static
(see Calling Java methods from Scheme) instead.
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 isclass
.
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 isclass
.
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.