Next: , Previous: Differences between Pre-Scheme & Scheme, Up: Pre-Scheme


9.2 Type specifiers

Although Pre-Scheme's static type system is based mostly on Hindley-Milner type inference, with as little explicit type information as possible, there are still places where it is necessary to specify types explicitly; for example, see Pre-Scheme access to C functions and macros. There are several different kinds of types with different syntax:

type-name
Symbols denote either record type or base types. Record types are defined with the define-record-type special form described later; the following base types are defined:
integer
Fixed-size integers (fixnums). This type is translated into C as long. The actual size depends on the size of C's long, which on most architectures is 32 bits.
float
Floating-point data. This type translates to C as double.
null
Type which has no value. The null type translates to the C void type.
unit
Type which has one value. Actually, this, too, translates to C's void, so that it has one value is not strictly true.
boolean
Booleans translate to the C char type. #t is emitted as TRUE, and #f, as FALSE; these are usually the same as 1 & 0, respectively.
input-port
output-port
I/O ports. On Unix, since Pre-Scheme uses stdio, these are translated to FILE *s, stdio file streams.
char
Characters. The size of characters is dependent on the underlying C compiler's implementation of the char type.
address
Simple addresses for use in Pre-Scheme's low-level memory manipulation primitives; see that section for more details.

(=> (argument-type ...) return-type ...)
The types of procedures, known as `arrow' types.
(^ type)
The type of pointers that point to type. Note that these are distinct from the address type. Pointer types are statically verified to be coherent data, with no defined operations except for accessing offsets in memory from the pointer — i.e. operations such as vector-ref —; addresses simply index bytes, on which only direct dereferencing, but also arbitrary address arithmetic, is available. Pointers and addresses are not interchangeable, and and there is no way to convert between them, as that would break the type safety of Pre-Scheme pointers.
(tuple type ...)
Multiple value types, internally used for argument & return types.