Subject: Re: Read Macro Characters and Packages
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 04 Jun 2006 18:52:20 -0500
Newsgroups: comp.lang.lisp
Message-ID: <ycudnbwOBJKp7x7ZnZ2dnUVZ_tydnZ2d@speakeasy.net>
Harald Hanche-Olsen  <hanche@math.ntnu.no> wrote:
+---------------
| Indeed, and if you consider the ASDF world, the loading of your
| package may not be the direct result of the user loading it, but
| rather the indirect result of some other package requiring it.  And
| then an altered readtable might mess things up for a third package
| that is being loaded after yours.
+---------------

As "R. Mattes" pointed out in another branch, what you're calling
"package" is really "module" or even just "file", yes? Not a CL
PACKAGE per se, right?

Anyway, one of the things one can do is make use of the fact that
both LOAD & COMPILE-FILE bind *READTABLE*... and thus restore it!
So putting this at the top of a file will confine the effects to
that file alone:

    (eval-when (:compile-toplevel :load_toplevel :execute)
      (setf *readtable* (copy-readtable))
      (setf (readtable-case *readtable* :whatever))
      (set-syntax-from-char ...whatever...)
      (set-dispatch-macro-character ...whatever...)
      ...etc...)


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607