Clozure / ccl

Clozure Common Lisp
http://ccl.clozure.com
Apache License 2.0
853 stars 103 forks source link

*read-suppress* signals errors on encountering undefined dispatch macro characters #124

Open spaghettisalat opened 6 years ago

spaghettisalat commented 6 years ago

The following example from the CLHS documentation on read-suppress (http://www.lispworks.com/documentation/HyperSpec/Body/v_rd_sup.htm)

(let ((*read-suppress* t)) (read-from-string "#garbage"))

produces an error, instead of quietly ignoring the undefined dispatch macro character.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/59988876-read-suppress-signals-errors-on-encountering-undefined-dispatch-macro-characters?utm_campaign=plugin&utm_content=tracker%2F27935804&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F27935804&utm_medium=issues&utm_source=github).
snuglas commented 5 years ago

I think the example was (incorrectly) trying to show a use of sharp-backslash with an unknown character name. The actual test case was '#\GARBAGE', not '#garbage'. But someone forgot that it was inside string quotes which would have mandated writing "#\GARBAGE" to make it a correct test. I really think that's an inadvertent oversight, as nowhere does it say that a dispatching macro should ignore any unknown character as the dispatch character (the letter 'g' if the example is to be taken literally) whereas it does make clear that the sharp-backslash syntax must disregard unknown character, if the example is to be taken illustratively. For comparison's sake, notice that every other test case uses a dispatch character that is valid, as in '#c1.2', '#RALPHA'.

spaghettisalat commented 5 years ago

Yes, that's true actually, I didn't consider that. However I still think that not signaling an error when encountering an undefined dispatch macro character serves the intended function of *read-suppress* better, even if it is not required by the standard.