Next: , Previous: , Up: expander specs   [Index]


15.9.3 Base object–type specifications

The following syntactic bindings are exported by the library (vicare expander).

Record Type: <object-type-spec>

Record–type name of the base type for all the object–type specifications. In this documentation, instances of this type used as arguments to function are indicated as ots.

Function: object-type-spec? obj

Return #t if obj is an instance of <object-type-spec>, otherwise return #f.

Function: object-type-spec.name ots
Function: object-type-spec.type-annotation ots

Return a syntax object representing the name or the type annotation of the object–type specification ots.

For some types the type name and the type annotation are equal, for example the core type names <fixnum>, <string>, et cetera are both type names and type annotations. For other types they are distinguished, for example if we define the type:

(define-type <list-of-fixnums>
  (list-of <fixnum>))

the type name is <list-of-fixnums> while the type annotation is (list-of <fixnum>).

Function: object-type-spec.uids-list ots

Return a list of symbols uniquely identifying this type specification. The head of the list is a symbol associated to this object–type; the second item in the list is associated to the parent; and so on.

Function: object-type-spec.parent-ots

Return #f or an instance of <object-type-spec> representing the parent of this object–type.

Function: object-type-spec.constructor-stx ots

Return a boolean value or a syntax object representing a Scheme expression that, expanded and evaluated at run–time, returns the default constructor function.

Function: object-type-spec.destructor-stx ots

Return #f or a syntax object representing a Scheme expression that, expanded and evaluated at run–time, returns a destructor function. The destructor is meant to be used as:

(?destructor ?instance)

and called explicitly with the delete syntax.

Function: object-type-spec.type-predicate-stx ots

Return #f or a syntax object representing a Scheme expression that, expanded and evaluated at run–time, returns a type predicate for the object–type ots.

The predicate is meant to be used as:

(?predicate ?object)

and called explicitly with the is-a? syntax.

The type predicate can be a syntax or core operation or a closure object like vector? or the predicate of record–types.

Function: object-type-spec.equality-predicate ots

Return #f or a syntax object which, expanded and evaluated at run–time, returns the equality predicate for this type.

Function: object-type-spec.comparison-procedure ots

Return #f or a syntax object which, expanded and evaluated at run–time, returns the comparison procedure for this type.

Function: object-type-spec.applicable-hash-function ots

Return #f or a syntax object representing a Scheme expression which, expanded and evaluated, returns the hash function for this type.

Function: object-type-spec.implemented-interfaces ots

A (possibly empty) proper list of <interface-type-spec> instances representing the implemented interfaces.

Function: object-type-spec.applicable-method-stx ots method-name

ots must an object-type specification record. method-name must be a symbol representing a method name in the object–type specification.

If method-name is eq? to:

return a syntax object representing a Scheme expression which, expanded and evaluated at run-time, returns the method’s applicable; otherwise return #f.

Function: object-type-spec=? ots0 ots

Return #t if all the <object-type-spec> instances given as operands are equal to each other; otherwise return #f.

Function: object-type-spec.ancestor-ots* ots

Return the, possibly empty, list of <object-type-spec> instances representing the ancestors list of ots. ots itself is not included in the list.

As example, when applied to the object–type specification of &condition, the return value is the list of specifications for:

(<record> <struct> <top>)
Function: object-type-spec.common-ancestor ots1 ots2

Search the hierarchies of ots1 and ots2 looking for a common ancestor. Return an instance of <object-type-spec> representing the ancestor’s <ots>. If no ancestor is found: return the specification of <top>.

Function: object-type-spec.matching-super-and-sub? ots1 ots2

Return #t if the specifications given as operands are matching super–type and sub–type; otherwise return #f.

The object–type specifications ots1 ots2 are matching super–type and sub–type when ots1 can be interpreted as super–type of ots2. For example:

Function: object-type-spec.compatible-super-and-sub? ots1 ots2

Return #t if the specifications given as operands are compatible super–type and sub–type; otherwise return #f. This function is meant to be used when we have already applied object-type-spec.matching-super-and-sub? to the same operands and the result was #f.

The operands ots1 and ots2 are compatible as super–type and sub–type when ots2 is a matching super–type of ots1. Whenever ots1 is the type specification of an expected argument and ots2 is the type specification of a given operand: it makes sense to consider them “matching” at expand–time, but to perform a further values validation at run–time.

Function: object-type-spec.procedure? ots

Return #t if ots represents the object–type specification of a closure object; otherwise return #f. This means ots is either an instance of <closure-type-spec> or it is the specification of <procedure>.

Function: object-type-spec.list-sub-type? ots

Return #t if ots represents the object–type specification of a list object; otherwise return #f.

Function: object-type-spec.vector-sub-type? ots

Return #t if ots represents the object–type specification of a vector object; otherwise return #f.


Next: , Previous: , Up: expander specs   [Index]