Syntax: define [:: type] value
In addition to define (which can take an optional type specifier),
Kawa has some extra definition forms.
Syntax: define-private name [:: type] value
Syntax: define-private (name formals) body
Same as
define, except thatnameis not exported.
Syntax: define-constant name [:: type] value
Definites
nameto have the givenvalue. The value is readonly, and you cannot assign to it. (This is not fully enforced.) If the definition is at module level, then the compiler will create afinalfield with the given name and type. Thevalueis evaluated as normal; however, if it is a compile-time constant, it defaults to being static.
Syntax: define-variable name [init]
If
initis specified andnamedoes not have a global variable binding, theninitis evaluated, andnamebound to the result. Otherwise, the value bound tonamedoes not change. (Note thatinitis not evaluated ifnamedoes 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--warn-undefined-variable.This is similar to the Common Lisp
defvarform. However, the Kawa version is (currently) only allowed at module level.
For define-namespace and define-private-namespace
see Namespaces.