I've spent some time on BUG 30, and have finally
ported Tim Moore's patch, and some CMUCL code to SBCL
to fix this nasty bug.
The attached patch will fix the following:
- BUG 30,
- another minor related BUG, fixed by Tim Moore, too,
- and some changes to the "defknown" of some readtable
related functions, that are incorporated in CMUCL.
(Pierre Mai made a proposal for this on cmucl-imp,
and it seems to be implemented in CMUCL.
I'll quote the essential parts from cmucl-imp, at the
end of this mail, concerning this readtable fix.)
To apply these patches, you'll have to rebuild SBCL;
"chill" does not work here, unfortunately.
For testing purposes, as well as to demonstrate the bugs,
I've attached some test code from the original bug report(s), too.
concerning the readtable:
From: pmai@... (Pierre R. Mai)
Date: 13 May 1999 18:57:55 +0200
After a quick glance at fndb.lisp and reader.lisp it seems to me that
a number of readtable functions aren't defknown correctly, and don't
handle the explicit nil case correctly. As per ANSI most readtable
functions take "readtable designator"s as arguments:
readtable designator n. a designator for a readtable; that is, an
object that denotes a readtable and that is one of: nil (denoting the
standard readtable), or a readtable (denoting itself).
At least the following functions don't treat this correctly, mostly
assuming explicit nil is the same as no mention, which defaults to
SET-SYNTAX-FROM-CHARACTER (**) (***)
(*) COPY-READTABLE handles all nils correctly, only the defknown type
for to-readtable is too restrictive, should be (or readtable null)
instead of only readtable.
(**) Whereas the spec calls for readtable designators for the modified
arguments in these functions, it also specifies that modifying
the standard readtable results in unspecified behaviour, so I
think we are already conforming, since anything is appropriate if
nil is supplied.
I also think that the specification of readtable designators
instead of readtables for these arguments is nonsensical, and
since there is precedent in other readtable-modifying functions
(i.e. copy-readtable and make-dispatch-macro-character) just
specifying readtable, I'm going to propose to X3J13 to change the
definitions of the other modifying functions to specify readtable
arguments instead of readtable designators. So I think we can
leave those functions as they are.
(***) The from table is handled correctly, so only the to table is of
concern, and that's covered by the comment above.
So in effect relaxing the defknown types on COPY-READTABLE,
GET-MACRO-CHARACTER and GET-DISPATCH-MACRO-CHARACTER from readtable to
(or readtable null), as well as changing GET-*-CHARACTER to handle
explicit nil correctly will move us into conformance, IMHO.
The SET-*-CHARACTER functions already bomb out internally on explicit
nil with a "NIL is not of type READTABLE" error. So only the
defknowns for these are slightly bogus, but will become totally
correct should X3J13 accept my proposal. They already provide useful
warnings, so I've left them as is.