GNU bug report logs - #61281
“`(a \, b)” equals to “`(a . ,b)”

Previous Next

Package: emacs;

Reported by: Xie Shynur <one.last.kiss <at> outlook.com>

Date: Sat, 4 Feb 2023 23:29:02 UTC

Severity: normal

Full log


Message #65 received at 61281 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Michael Heerdegen <michael_heerdegen <at> web.de>, Xie Shynur
 <one.last.kiss <at> outlook.com>
Cc: "61281 <at> debbugs.gnu.org" <61281 <at> debbugs.gnu.org>
Subject: RE: [External] : 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.




This bug report was last modified 2 years and 127 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.