Subject: Re: [External] : Re: bug#61281: “`(a \,b)” equals to “`(a . ,b)”

From: Michael Heerdegen <[email-masked]>
Date: Mon, 06 Feb 2023 04:03:18 +0100

Drew Adams <[email-masked]> writes:

> And the question is about "\,", not ",".
>
> (setq ,X  42) ; => 42
> (setq \,X 42) ; => (wrong-type-argument symbolp (\, X))

The other way round.

"\,X" is interpreted as symbol, just as "\,".

What's the question about "\,"?

> (I'd be interested in what the case is in Common
> Lisp, including what a typical implementation is.)

AFAIU, there are different implementations.  I tested two random CL and
two random scheme interpreters.  Of those 4, 3 expanded
,X --> (unquote X), and in one case ,X was read as an atomic expression.

> The question is whether \, and , should have the
> same behavior.  Certainly \z and z have the same
> behavior.  But character z has no special behavior
> inside a backquote.

I think the necessity to escape the comma to get the symbol has been
introduced to avoid ambiguities with uses of the reader macro.

> \@ and @ don't have the same behavior inside a
> backquote.  And neither do \. and . -- only \,
> and , have the same behavior.  To me, that's just
> an implementation/design thing, not something
> normal or inevitable.  Not a big deal, not the
> end of the world.  I minor unfortunate thing
> (gotcha).

In any case, much too late to change it.

> I pointed to the comments in the code.  They tell the story.  But I
> don't think there's any such explanation/description in the doc.

Yes, it would be good to add something.

Michael.