These types are predefined with the following names.
Instead of plain
you can also use
the syntax typename
<
with angle brackets,
but that syntax is no longer recommended, because it doesn’t
“fit” as well with some ways type names are used.
typename
>
To find which Java classes these types map into, look in
kawa/standard/Scheme.java
.
Note that the value of these variables are instances
of gnu.bytecode.Type
,
not (as you might at first expect) java.lang.Class
.
The numeric types (number
, quantity
,
complex
, real
, rational
, integer
,
long
, int
, short
, byte
ulong
, uint
, ushort
, ubyte
,
double
, float
)
are discussed in Numerical types.
The types character
and char
are discussed in Characters.
An arbitrary Scheme value - and hence an arbitrary Java object.
The type of Scheme symbols. (Implemented using the Java class
gnu.mapping.Symbol
.) (Compatibility: Previous versions of Kawa implemented a simple Scheme symbol using an internedjava.lang.String
.)
The type of keyword values. See Keywords.
The type of Scheme lists (pure and impure, including the empty list).
The type of Scheme pairs. This is a sub-type of
list
.
The type of Scheme strings. (Implemented using
gnu.lists.IString
orjava.lang.String
for immutable strings, andgnu.lists.FString
for mutable strings. These all implement the interfacejava.lang.CharSequence
. (Compatibility: Previous versions of Kawa always usedgnu.lists.FString
.)
The type of Scheme character values. This is a sub-type of
Object
, in contrast to typechar
, which is the primitive Javachar
type.
The type of Scheme vectors.
The type of Scheme procedures.
The type of Scheme input ports.
The type of Scheme output ports.
This type name is a special case. It specifies the class
java.lang.String
. However, coercing a value toString
is done by invoking thetoString
method on the value to be coerced. Thus it "works" for all objects. It also works for#!null
.When Scheme code invokes a Java method, any parameter whose type is
java.lang.String
is converted as if it was declared as aString
.
A parameter object, as created by
make-parameter
. This type can take a type parameter (sic):(define-constant client ::parameter[Client] (make-parameter #!null))This lets Kawa know that reading the parameter (as in
(client)
) returns a value of the specified type (in this caseClient
).
More will be added later.
A type specifier can also be one of the primitive Java types.
The numeric types long
, int
, short
,
byte
, float
, and double
are converted from the
corresponding Scheme number classes. Similarly, char
can be converted to and from Scheme characters. The type
boolean
matches any object, and the result is false
if and only if the actual argument is #f
.
(The value #f
is identical to Boolean.FALSE
,
and #t
is identical to Boolean.TRUE
.)
The return type void
indicates that no value is returned.
A type specifier can also be a fully-qualified Java class name
(for example java.lang.StringBuffer
). In that case,
the actual argument is cast at run time to the named class.
Also, java.lang.StringBuffer[]
represents
an array of references to java.lang.StringBuffer
objects.
Used to specify that the type is unknown, and is likely to change at run-time. Warnings about unknown member names are supressed (a run-time name lookup is formed). An expression of type
dynamic
is (statically) compatible with any type.