In addition to
define (which can take an optional type specifier),
Kawa has some extra definition forms.
define, except that
nameis not exported.
nameto have the given
value. The value is readonly, and you cannot assign to it. (This is not fully enforced.)
define-early-constantis used or the
valueis a compile-time constant, then the compiler will create a
finalfield with the given name and type, and evaluate
valuein the module’s class initializer (if the definition is static) or constructor (if the definition is non-static), before other definitions and expressions. Otherwise, the
valueis evaluated in the module body where it appears.
valueis a compile-time constant, then the definition defaults to being static.
initis specified and
namedoes not have a global variable binding, then
initis evaluated, and
namebound to the result. Otherwise, the value bound to
namedoes not change. (Note that
initis not evaluated if
namedoes have a global variable binding.)
Also, declares to the compiler that
namewill be looked up in the dynamic environment. This can be useful for shutting up warnings from
This is similar to the Common Lisp
defvarform. However, the Kawa version is (currently) only allowed at module level.