Next: annotations signatures, Previous: annotations syntaxes, Up: annotations [Contents][Index]
The following syntactic bindings are exported by the library
(vicare expander)
.
Expand to a syntax object representing the type annotation of
?type. If ?type is a compound annotation (or
,
and
, condition
, …) some simplification may have
been applied to the input to produce the output.
(type-annotation-syntax (or <fixnum> <bignum>)) ⇒ (or <fixnum> <bignum>) (type-annotation-syntax (or (enumeration hello salut) (enumeration ciao) (enumeration ohayo ciao))) ⇒ (enumeration hello salut ciao ohayo)
Expand to a boolean constant: #t
if ?type1 is equal to
?type2; otherwise #f
.
(type-annotation=? <top> <top>) ⇒ #t (type-annotation=? <fixnum> <fixnum>) ⇒ #t (type-annotation=? <fixnum> <positive-fixnum>) ⇒ #f (internal-body (define-type <my-fixnum> <fixnum>) (type-annotation=? <fixnum> <my-fixnum>)) ⇒ #t (type-annotation=? (lambda (<fixnum>) => (<fixnum>)) (lambda (<fixnum>) => (<fixnum>))) ⇒ #t
Expand to a boolean constant: #t
if ?type1 is a super–type
of ?type2; otherwise #f
.
NOTE The type
<top>
is conventionally the super–type of all the types, with the exception of<void>
. The type<bottom>
is conventionally the sub–type of all the types.
(type-annotation-super-and-sub? <number> <fixnum>) ⇒ #t (type-annotation-super-and-sub? <number> <string>) ⇒ #f (type-annotation-super-and-sub? <top> <number>) ⇒ #t (type-annotation-super-and-sub? <number> <top>) ⇒ #f (expansion-of (type-annotation-super-and-sub? <number> <fixnum>)) ⇒ (quote #t) (expansion-of (type-annotation-super-and-sub? <number> <string>)) ⇒ (quote #f) (define-record-type alpha) (define-record-type beta (parent alpha)) (define-record-type gamma (parent beta)) (type-annotation-super-and-sub? alpha beta) ⇒ #t (type-annotation-super-and-sub? beta alpha) ⇒ #f (type-annotation-super-and-sub? alpha gamma) ⇒ #t (type-annotation-super-and-sub? gamma alpha) ⇒ #f (type-annotation-super-and-sub? beta gamma) ⇒ #t (type-annotation-super-and-sub? gamma beta) ⇒ #f
Match the two type annotations as if: ?type1 is the type of an argument requested by a closure object; ?type2 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 annotation.
possible-match
If there is a possible match between the argument’s and operand’s annotation; the operand must be further validated at run–time.
no-match
If there is no match between the argument’s and operand’s annotation.
Expand to a syntax object representing the type annotation that is the common ancestor of ?type1 and ?type2.
(type-annotation-common-ancestor <top> <top>) ⇒ #'<top> (type-annotation-common-ancestor <top> <fixnum>) ⇒ #'<top> (type-annotation-common-ancestor <fixnum> <top>) ⇒ #'<top> (type-annotation-common-ancestor <fixnum> <flonum>) ⇒ #'<real>
Expand to a (possibly empty) list of type annotations representing the ancestors of ?type. ?type is not included.
(type-annotation-ancestors <top>) ⇒ () (type-annotation-ancestors <void>) ⇒ () (type-annotation-ancestors <condition>) ⇒ (<record> <struct> <top>) (type-annotation-ancestors <positive-fixnum>) ⇒ (<fixnum> <exact-integer> <integer> <rational> <rational-valued> <real> <real-valued> <complex> <number> <top>)
Next: annotations signatures, Previous: annotations syntaxes, Up: annotations [Contents][Index]