From: Peter Graves <peter@ar...> - 2007-02-22 16:15:40
On Mon, 19 Feb 2007 at 21:49:44 +0100, Eric Marsden wrote:
> An optional third argument to GET-DISPATCH-MACRO-CHARACTER of NIL
> should be equivalent to not specifying that argument:
You're right; there's a bug here in the existing code. But the fix is a
bit more complicated.
If the optional readtable argument isn't supplied, the default per CLHS
is the current readtable. But if the argument is supplied, it is
treated as a readtable designator, and per the "readtable designator"
entry in the CLHS glossary, a value of NIL designates the standard
readtable, not the current readtable.
SBCL handles it like this:
(defun get-dispatch-macro-character (disp-char sub-char
&optional (rt *readtable*))
(let* ((sub-char (char-upcase sub-char))
(rt (or rt *standard-readtable*))
I've committed the moral equivalent of this fix in ABCL's Java
implementation of GET-DISPATCH-MACRO-CHARACTER. For good measure, I
went through the other readtable functions and cleaned up the same
issue in a couple of other places, with a little gratuitous refactoring
and renaming thrown in.
ABCL now passes all the reader tests in ansi-tests and has only one
failure (instead of three) in sacla's must-reader.lisp.