bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61281: “`(a \, b)” equals to “`(a . , b)”


From: Drew Adams
Subject: bug#61281: “`(a \, b)” equals to “`(a . , b)”
Date: Mon, 6 Feb 2023 05:01:31 +0000

> (2) We should (in the recently added function docstrings and the manual)
> explain that the reader constructs `X, ,X and ,@X are expanded to (or
> equivalent to) (\` X), (\, X) and (\,@ X) respectively, where the cars
> are the symbols with the names "`", "," and ",@".

Yes and no, no?

I see a difference between escaped comma and
escaped comma before @.  The above "are expanded
to" doesn't cover this, I think.  For example:

`(a  ,@ foo) ; ==> (a 4 5)
`(a \,@foo)  ; ==> (a \,@ foo) - good
`(a \,@ foo) ; ==> (a \,@ foo) - good

`(a  , foo) ; ==> (a 4 5)
`(a \,foo)  ; ==> (a \,foo) - good
`(a \, foo) ; ==> (a 4 5)   - bad, the bug case

The \,@ cases and the \,foo case "work" because
\, immediately followed by any escaped char or
unescaped whitespace etc. works.  It's only \,
followed by unescaped whitespace etc. that
doesn't work.

> While this is an implementation detail, not knowing about that fact
> leaves the semantics of expressions like above unclear, which is not
> good.

Agreed, but I don't think just describing those
expansions that way is sufficient.  For one
thing, what's X?  Whether certain chars follow
the comma immediately makes a difference.

> (3) Fix the header in backquote.el as suggested by Drew, e.g. like this:

+;; When the Lisp reader sees `X it generates (\` X).
+;; When it sees ,X it generates (\, X).  For ,@X it generates
+;; (\,@ X).

I don't think that's sufficient - see above.
,X and ,@X aren't handled the same, and it
matters what X is.  X is not necessarily a new
sexp.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]