Next: , Up: iklib syntaxes   [Index]


6.8.1 Local libraries

R6RS defines libraries to be top–level symbolic expressions; the form library can appear only at the top–level; Library form. Vicare extends the notion of libraries by having the library (vicare) export a library syntax; such syntax can be used anywhere a definition can be used and the defined library can be imported in its region of visibility.

The following is a perfectly valid Vicare program:

(import (vicare))

(let ()
  (library (ciao)
    (export a)
    (import (rnrs))
    (define a 1))

  (library (hello)
    (export b)
    (import (rnrs))
    (define b 1))

  (import (ciao))
  (import (hello))

  (display (list a b)))