[previous] [up] [next]     [contents] [index]
Next: Tools Up: PLT DrScheme: Programming Environment Previous: Printer

Libraries

Libraries are the simpler of the two forms of extensibility in DrScheme. They are designed for courses, where you want to extend the language of DrScheme with some new functions on a temporary basis, and to let the student control which sets of functions are available at any given time.

Each library must have a file whose last expression evaluates to a unit/sig that imports the plt:userspace^ signature. That file is the file that the users select when installing the library. The names in the export signature of that unit are added to the users namespace, via invoke-open-unit/sig. (See units for more information.)

The plt:userspace^ signature contains MzLib's pretty print, file, function, compat, and string libraries (see MzLib). It also contains the graphics library, the turtle library, and all of the names defined in the toolbox manual.

For example, this unit/sig defines a library which adds the binding `four' to the users namespace:

(unit/sig (four)
  (import plt:userspace^)
  (define four 4))

See selecting libraries for more information.



PLT