Subject: Re: Problem enabling bracket mode it CLSQL
From: (Rob Warnock)
Date: Sun, 22 Jan 2006 20:15:22 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
Coby Beck <> wrote:
| "Rob Warnock" <> wrote:
| > <> wrote:
| > +---------------
| > | Since the reader will read in the whole defun form before evaluating
| > | it, it is too late to do the call inside the defun. The reader has
| > | already processed your [*] so changing the syntax will not work.
| > +---------------
| >
| > And if file-compiling it, the OP'll probably need an EVAL-WHEN wrapped
| > around them, too...
| I don't think so, but I am not a language lawyer.

Oh, yes, you definitely *do* need the EVAL-WHEN![1] I got burned by
that once very early after starting to use CL. Remember, the source
code gets read in the compile-time environment, which means that the
reader macro must have been enabled in the compile-time environment
*before* any forms using the special syntax are READ from the source
file by the file compiler.

Note that this also means that not only does the form which enables
the syntax need to be in an EVAL-WHEN, but also that you need to
make sure that the function which *implements* the special syntax
needs to be LOADed (or REQUIREd) into the compile-time environment[2],
and that LOAD (or REQUIRE) will itself need to be wrapped in EVAL-WHEN.


[1] Well, unless you deliberately "pollute" the compile-time environment
    by enabling the syntax *before* calling* COMPILE-FILE, depending
    on the current *READTABLE* to be used when reading the file to be
    compiled. Some implementations allow such deliberate "leakage"
    [e.g., CMUCL -- I just tried it], but AFAICT the CLHS says nothing
    about the subject, which means one can probably not depend on it
    in general.

[2] Well, unless said function is a literal in the enabling form.

Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607