On 27 Mar 2003, Sam Steingold wrote:
> > * In message <Pine.LNX.4.44.0303270725060.12820-100000@...>
> > * On the subject of "Re: New patch."
> > * Sent on Thu, 27 Mar 2003 07:27:39 -0800 (PST)
> > * Honorable Kaz Kylheku <kaz@...> writes:
> >
> > http://users.footprints.net/~kaz/clisp-cvs-2003-04-26-backquote.diff
>
> read-from-string "`,@x")
> -ERROR
> +(SYSTEM::BACKQUOTE (SYSTEM::SPLICE X))
>
> this is not good: backquote is a reader macro, so the error must be
> signalled at read time, not macroexpand time (CMUCL and unpatched CLISP
> signal at read time).
If you are really adamant about catching `,@FORM at read time,
it can be achieved trivially. After the the backquote reader
reads the following object, if it's a cons whose car is the symbol
SYSTEM::SPLICE or SYSTEM::NSPLICE, then signal the error.
But I think that the macro-expansion-time check should stay in place,
to trap cases when the error occurs in ``synthetic'' backquotes.
CLHS says that `,@FORM ``has undefined consequences'', which means that
the behavior can range from harmless to fatal, without signaling an
error. So I think this implementation is acceptable. In principle we
could even silently provide some extension of behavior.
In practice, will the difference matter to anyone? Typically the
backquote macro will be expanded at compile time, which is right
after the source is read.
It makes a difference to backquotes that are not evaluates or expanded,
such as quoted occurences. This just means that CLISP won't be a
portability helper to the user in some rare cases.
Besides, both the unpatched CLISP and CMUCL have backquote bugs, so
phwft! :) I got this in an e-mail from Rob Warnock, though I did not
try it first hand:
cmucl> ``(,@,@'(a b c d))
Reader error at 202581 on #<Two-Way Stream, Input = #<Synonym Stream to SYSTEM:*STDIN*>, Output = #<Synonym Stream to SYSTEM:*STDOUT*>>:
,@ after backquote in '(A B C D)
Looks like the CMUCL reader likes to signal a ``,@ after backquote''
error even when no such mistake occurs in the source, and consequently
fails to handle ,@,@ properly! Maybe if I ever fix this bug, the CMUCL
behavior will change so that `,@FORM is caught later than read time. ;)
|