Types

A slot's type restricts the kinds of values it may contain. The slot is specified in the slot description by one of the following Prolog terms with the corresponding meaning. Most of these will be familiar, but the last four, address, term, Class and pointer(Type), require some additional explanation:


Type
Description
integer
32-bit signed integer
short
16-bit signed integer
char
8-bit signed integer
unsigned_short
16-bit unsigned integer
unsigned_char
8-bit unsigned integer
float
32-bit floating point number
double
64-bit floating point number
atom
Prolog atom (32-bit pointer)
address
32-bit address

The address type is intended for use with foreign code. A slot of this type might store an address returned from a foreign function. That address might, in turn, be used in calling another foreign function or with the assign/2 predicate or with arithmetic operators such as integer_at. Hence, most Prolog programmers can safely ignore this type.

term
Prolog term

The term type is for general Prolog terms. Such a slot can hold any of the other types. However, if you know a slot will be used to hold only values of a particular type, it is more efficient to specify that type in the class definition.

Storing a term containing free variables is similar to asserting a clause containing free variables into the Prolog database. The free variables in the term are replaced with new variables in the stored copy. And, when you fetch the term from the slot, you are really fetching a copy of the term, again with new variables.

Class
where Class is the name of a defined class

The class type is for any object in a class defined with Quintus Objects. Such a slot holds an object of its class or one of that class's descendants, or the null object (see obj-scl-slt-null).

pointer(Type)
where Type is an atom

The pointer type is intended for use with the Structs Package, ProXT or ProXL. It is similar to the address type, except that access to this slot yields, and update to this slot expects, a term of arity 1 whose functor is Type and whose argument is the address. Again, most Prolog programmers can safely ignore this type.

Please note that there is no unsigned_int or unsigned_long type, because Prolog itself currently cannot represent such a number. You should represent such numbers as type integer with care. Arithmetic operations on unsigned integers represented this way will work as expected, however comparisons will not! This is inherent in using Prolog to manipulate 32 bit unsigned numbers in general; it is not specific to Quintus Objects.