[Openmcl-devel] non-terminating macro character after Sharpsign Colon

Gary Byers gb at clozure.com
Thu Feb 21 19:29:18 PST 2013


CLHS says (in 2.4.8.5) that #: must be followed by a symbol-name, which
"must have the syntax of a symbol with no package prefix."

A symbol can't begin with a macro character, though a non-terminating macro
character can appear later in a token that has "the syntax of a symbol".

(Of all of the places where the spec uses imprecise language that's
subject to multiple interpretations, this seems ro me to be pretty far
down the list.  I don't know whether other implementations that behave
differently do so intentionally or what other reasonable interpretations
would be if so.)

On Fri, 22 Feb 2013, Anton Vodonosov wrote:

> Hello.
>
> I set $ as a non-terminating macro characters.To smiplify the example,
> let the macro function for that character to be a dummy one:
>
> (set-macro-character #\$
>                     (lambda (stream char) :x)
>                     t
>                     *readtable*)
>
> When $ is a macro character, CCL's reader rejects uninterned symbols
> starting from $, for example #:$, #:$asdf.
>
> It signals error:
>
> Reader error: Illegal symbol syntax.
>   [Condition of type SIMPLE-ERROR]
>
> Restarts:
> 0: [RETRY] Retry SLIME interactive evaluation request.
> 1: [*ABORT] Return to SLIME's top level.
> 2: [ABORT-BREAK] Reset this thread
> 3: [ABORT] Kill this thread
>
> Backtrace:
>  0: (CCL::READ-SYMBOL-TOKEN #<STRING-INPUT-STREAM  #x2100D7ECED>)
>  1: (#<Anonymous Function #x1004DA5FF> #<STRING-INPUT-STREAM  #x2100D7ECED> #\: NIL)
>  2: (CCL::READ-DISPATCH #<STRING-INPUT-STREAM  #x2100D7ECED> #\#)
>  3: (CCL::%PARSE-EXPRESSION #<STRING-INPUT-STREAM  #x2100D7ECED> #\# NIL)
>  4: (CCL::%READ-FORM #<STRING-INPUT-STREAM  #x2100D7ECED> 0 NIL)
>  5: (CCL::READ-INTERNAL #<STRING-INPUT-STREAM  #x2100D7ECED> T NIL NIL)
>  6: (READ #<STRING-INPUT-STREAM  #x2100D7ECED> T NIL NIL)
>  7: (READ-FROM-STRING "#:$" T NIL :START 0 :END NIL :PRESERVE-WHITESPACE NIL)
>  8: ((:INTERNAL SWANK::FROM-STRING))
>
>
> Why it is so? After all, the macro character is non-terminating, so in the middle
> of the tocken it should have no effect.
>
> I have tested on other lisps. SBCL and ABCL read #:$ without problems.
> CLISP on the other hand, like CCL can't read #:$.
>
> Best regards,
> - Anton
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list