Next: , Previous: , Up: iklib expander   [Index]


6.14.6 Extended library exports

Vicare allows the export syntax to appear at the top level of a library among the definitions, not only as third form of a library form.

Syntax: export ?export-spec ...

Export the specified bidings from the current library or module. When export appears at the top level of a library: it exports the specified bindings from the library. When export appears in the body of a module: it exports the specified bindings from the module (not from the enclosing library).

Here is an example of library exporting a binding with a export at the end:

;;; file "alpha.sls"
(library (alpha)
  (export red)
  (import (vicare))
  (define (blue)
    'blue)
  (define (red)
    'red)
  (export blue))

;;; file "program.sps"
(import (vicare)
  (alpha))
(pretty-print (red)  (current-error-port))
(pretty-print (blue) (current-error-port))

Here is an example of module exporting a binding with export:

(import (vicare))

(module (green)
  (define (green) 'green)
  (define (yellow) 'yellow)
  (export yellow))

(list (green) (yellow)) ⇒ (green yellow)