Previous: using libraries compiling, Up: using libraries [Index]
Consider a program using the procedure pretty-print
to format
some code, and suppose further that pretty printing is just a nice
add–on (e.g. using write suffices, but pretty–printing is
just prettier).
Vicare exports a good pretty–printing facility in its
(vicare)
library. However, since pretty-print
is not a
standard procedure, a program that uses it would be rendered unportable
to other R6RS Scheme implementations.
The programmer can put the .vicare.sls
extension to use in this
situation, by writing two versions of a (pretty-printing)
library: one for use by Vicare, and one portable for other
implementations.
;; pretty-printing.vicare.sls -- ;; ;; Can be used only by Vicare Scheme. (library (pretty-printing) (export pretty-print) (import (only (vicare) pretty-print))) ;;; end of file
;; pretty-printing.sls -- ;; ;; For any other Scheme implementation, portable though ;; not very pretty. (library (pretty-printing) (export pretty-print) (import (rnrs)) (define (pretty-print x port) (write x port) (newline port))) ;;; end of file