Next: , Previous: , Up: overview   [Contents][Index]


1.2 Enabling typed language extensions

Typed language extensions are off by default. To enable the extensions we have to use the typed-language option as follows:

we usually want to import the library (vicare) to use the extended syntaxes that recognise type definitions and annotations.

We can use the function typed-language-enabled? to enable the typed language at the REPL (see (vicare-scheme)typed-language-enabled?).

Strict type checking

An additional option is available for both programs and libraries: strict-type-checking. It enables expand–time warnings about non–exact matching between values and the typed variables they are assigned to.

Under the typed language, the types of variables and values are matched as with the following forms:

(import (prefix (vicare expander) xp::))

(xp::type-annotation-matching <number> <fixnum>)
⇒ exact-match

(xp::type-annotation-matching <fixnum> <number>)
⇒ possible-match

that is:

When the option strict-type-checking is used: a warning is raised when a possible match is detected. For example, the following let syntax use will raise a warning because the right–hand side expression returns a <integer>, while the syntactic binding for O expects a <fixnum>:

(let (({O <fixnum>} (cast-signature (<integer>) (read))))
  ---)

When examining the raised warnings we must remember that some binding syntaxes expand into uses of other binding syntaxes; for some built–in syntaxes of this type:


Next: , Previous: , Up: overview   [Contents][Index]