| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
26.4.2 Declaring Java classes
The <declare-class-clause> clause denotes importation of Java classes.
<declare-class-clause> → |
When the compiler encounters a Java class declaration, it automatically
creates a predicate. If the class identifier is id, the predicate
is named id?. In addition, the compiler generates functions that
fetch and set the field values. For a field named f, these functions
are named id-f and id-f-set!. Methods and constructors are
also always prefixed the name of the class. That is, for a method named
m of a class k, the Scheme name of the method is k-m.
Example:
(module java-example
(java (class point
(constructor new-default ())
(field x::int "x")
(method show::void (::point) "show")
(method static statistics::int () "PointStatistics")
"Point")
(class point-3d::point
"Point3D")))
(let ((p (point-new-default)))
(print (point? p)) -| |
