Next: expander specs core, Previous: expander specs retrieving, Up: expander specs [Index]
The following syntactic bindings are exported by the library
(vicare expander)
.
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.
Return #t
if obj is an instance of <object-type-spec>
,
otherwise return #f
.
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>)
.
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.
Return #f
or an instance of <object-type-spec>
representing
the parent of this object–type.
Return a boolean value or a syntax object representing a Scheme expression that, expanded and evaluated at run–time, returns the default constructor function.
#f
: this object–type has no constructor,
so trying to use the syntax new
will cause an expand–time
exception.
#t
: this object–type has no constructor,
but requires the object to be supplied in its already–built form to the
syntax new
. For example:
(new <fixnum> 123)
must expand to an equivalent of:
(assert-signature-and-return (<fixnum>) 123)
(?constructor ?arg ...)
and called explicitly with the syntax new
.
The constructor can be a syntax or core operation like
$make-clean-vector
or a closure object like vector
or the
maker of record–types.
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.
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.
Return #f
or a syntax object which, expanded and evaluated at
run–time, returns the equality predicate for this type.
Return #f
or a syntax object which, expanded and evaluated at
run–time, returns the comparison procedure for this type.
Return #f
or a syntax object representing a Scheme expression
which, expanded and evaluated, returns the hash function for this type.
A (possibly empty) proper list of <interface-type-spec>
instances
representing the implemented interfaces.
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
.
Return #t
if all the <object-type-spec>
instances given as
operands are equal to each other; otherwise return #f
.
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>)
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>
.
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:
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.
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>
.
Return #t
if ots represents the object–type specification of
a list object; otherwise return #f
.
Return #t
if ots represents the object–type specification of
a vector object; otherwise return #f
.
Next: expander specs core, Previous: expander specs retrieving, Up: expander specs [Index]