[Antik-devel] Sharp-m reader macro ignores *read-suppress* (+ patch)

Martin Schmauder martinschmauder at googlemail.com
Wed Apr 18 15:27:40 UTC 2012


Hi,

I have encountered a problem with the sharp-m reader macro function.

The sharp-m reader macro function (lambda in grid/functions.lisp,
l. 202) uses the function cl:read-delimited-list to read the macro
arguments. However, when cl:*read-suppress* is true,
read-delimited-list always returns nil (See *read-suppress* in CLHS.)
That value is then (wrongly) passed to grid:check-initial-contents,
which (rightly) signals the error "Initial-contents specified as
NIL."

The following code can be used to observe the behaviour. No matter
what (valid or invalid) code is inside the sharp-m parentheses, the
error will be signaled.

(let ((*read-suppress* t))
  (with-input-from-string (stream "#m(1 2 3)")
    (read stream)))

The solution is to call read-delimited-list and then check if we have
to ignore its return value with "(unless *read-suppress* ...)". Patch
attached.

By the way, how I encountered this issue: When I compile a file with
C-c C-k and the compilation yields warnings or notes, the Slime/SBCL
combination seems to re-read the file with *read-suppress*. Any
sharp-m macro that is then read triggers the error. Try with:
#m(1 2 3)
(defun foo (bar)) ; unused variable style-warning


Comments?

Martin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Sharp-m-reader-macro-must-not-ignore-read-suppress.patch
Type: text/x-patch
Size: 1425 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/antik-devel/attachments/20120418/f99f2076/attachment.bin>


More information about the antik-devel mailing list