Previous: descriptors signatures, Up: descriptors [Contents][Index]
The following syntactic bindings are exported by the library
(vicare system type-descriptors)
.
Expand to an expression which, compiled and evaluated, returns the type descriptor of the parent of the specified type annotation.
(type-descriptor-parent <fixnum>) ⇒ <exact-integer>-ctd (type-descriptor-parent (pair <fixnum> <flonum>)) ⇒ <pair>-ctd (define-record-type alpha) (type-descriptor-parent alpha) ⇒ <record>-ctd (define-record-type beta (parent alpha)) (type-descriptor-parent beta) → (record-type-descriptor alpha)
Expand to an expression which, compiled and evaluated, returns the list of type descriptors representing the ancestors of the specified type annotation. The descriptor of the annotation itself is not included.
(type-descriptor-ancestors <top>) ⇒ () (type-descriptor-ancestors <string>) ⇒ (<top>-ctd) (type-descriptor-ancestors <record>) ⇒ (<struct>-ctd <top>-ctd) (type-descriptor-ancestors <nelist>) ⇒ (<list>-ctd <top>-ctd)
Expand to an expression which, compiled and evaluated, returns #t
if the type descriptors associated to the specified type annotations are
equal; otherwise it returns #f
.
(type-descriptor=? <top> <top>) ⇒ #t (type-descriptor=? <top> <number>) ⇒ #f (type-descriptor=? (pair <fixnum> <string>) (pair <fixnum> <string>)) ⇒ #t
Expand to an expression which, compiled and evaluated, returns #t
if the type descriptor associated to ?type-annotation1 is a
matching super–type of the type descriptor associated to
?type-annotation2; otherwise it returns #f
.
(type-descriptor-super-and-sub? <top> <top>) ⇒ #t (type-descriptor-super-and-sub? <top> <number>) ⇒ #t (type-descriptor-super-and-sub? <number> <top>) ⇒ #f (type-descriptor-super-and-sub? (pair <fixnum> <null>) (list <fixnum>)) ⇒ #t
Expand to an expression which, compiled and evaluated, matches the arguments as if: the descriptor associated to ?type-annotation1 is the type of a formal argument requested by a closure object; the type descriptor associated to ?type-annotation2 is the type of the operand given to a closure object application.
Expand to a quoted symbol:
exact-match
If there is an exact match between the argument’s and operand’s descriptors.
possible-match
If there is a possible match between the argument’s and operand’s descriptors; the operand must be further validated at run–time.
no-match
If there is no match between the argument’s and operand’s descriptors.
The arguments signature-annotation must be proper or improper lists of type annotations. Expand to an expression which, compiled and evaluated, matches the arguments as if:
<descriptors-signature>
instance associated to
?signature-annotation1 represents the types of formal arguments
requested by a closure object.
The <descriptors-signature>
instance associated to
?signature-annotation2 represents the types of the operands given
to a closure object application.
Expand to a quoted symbol:
exact-match
If there is an exact match between the argument’s and operand’s descriptors.
possible-match
If there is a possible match between the argument’s and operand’s descriptors; the operand must be further validated at run–time.
no-match
If there is no match between the argument’s and operand’s descriptors.
Usage examples:
(descriptors-signature-matching (<number> <string>) (<fixnum> <nestring>)) ⇒ exact-match (descriptors-signature-matching (<number> <string>) (<fixnum> <top>)) ⇒ possible-match (descriptors-signature-matching (<number> <string>) (<fixnum> <vector>)) ⇒ no-match
Previous: descriptors signatures, Up: descriptors [Contents][Index]