[previous] [up] [next]     [index]
Next: Tools Up: Extending DrScheme Previous: Extending DrScheme

Libraries

A single Scheme source file defines a library (although the file is likely to access other files). The last expression in the file must return a signed unit (see units) that imports the plt:userspace^ signature. When a user selects the library into DrScheme, DrScheme adds the names in the unit's export signature to the user's namespace.

The plt:userspace^ signature is defined in the userspcs.ss file of the userspce collection (see Library Collections and MzLib). A library file is always loaded with the MrEd language, but in case-sensitive mode (so that a library can export case-sensitive names to the teaching languages).

As an example example, the following signed unit defines a library that adds the binding four to the user's namespace:

  (unit/sig (four)
    (import plt:userspace^)
    (define four 4))
For more interesting examples, see the teach directory of the lib directory in the PLT installation.



PLT