unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Xie Shynur <one.last.kiss@outlook.com>,
	"61281@debbugs.gnu.org" <61281@debbugs.gnu.org>
Subject: bug#61281: “`(a \, b)” equals to “`(a . , b)”
Date: Sun, 5 Feb 2023 15:48:54 +0000	[thread overview]
Message-ID: <SJ0PR10MB54889CF4F61C59C39FDDFEB9F3D59@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <875ycghgv1.fsf@web.de>

> > Yes, but see above.  I think \, should be
> > read as the symbol whose print name is ",".
> 
> That's the case.

Inside a backquote, an escaped comma's handled
as if it were unescaped.  That's the bug.
 
> > To me, `(a \, b) should be treated like
> > (a foo b): a list of 3 symbols - no evaluation.
> 
> No evaluation by backquote, you mean?

I mean that \, is not (should not be) the same
as comma whether inside or outside a backquote.

It is (should be) only an UNescaped comma that
(1) when inside backquote introduces evaluation
of what follows it and (2) raises an error when
not inside a backquote.

> Yes, you need to say `(a ,'\, b).

When I said "no evaluation" I meant that \,
shouldn't cause evaluation inside backquote. 
I wasn't talking about evaluating the symbol
\, itself - I'm not interested in doing that.

I'm talking about the special interpretation
of \, here, i.e., its being handled just like
an UNescaped comma, instead of just like any
other symbol (e.g. foo).

> Is this really different in other Lisps 
> (isn't `,' a reader macro in Common Lisp)?

It may be, dunno, but I'd bet that Common Lisp
treats unescaped comma differently from escaped
comma.

I meant that reading \, should be like reading
foo, whether inside backquote or not.  The only
thing that should introduce evaluation within
a backquote is an UNescaped comma.

\, is not ,

Dunno about the reader macro question.  (But
I'm guessing that the overall difference here
is how the CL reader works, yes.)

> I don't decide about this, but when we changed
> the semantics of `,' like you suggest, we will
> probably break a lot of code for no real gain
> (I think the semantics in Elisp clear and easy
> to understand), so this sounds like a very bad
> idea to me.

I'm not saying the bug should be fixed.  I have
the same concern you express.  Not that I really
think that "a lot of code" will break (I don't),
but that (1) some code might depend on this
behavior and so break, and (more importantly)
(2) it's likely that the new code will introduce
other (new) backquote bugs.  There be dragons.

What I expect is that the bug will be closed as
"wont-fix".  This should nevertheless be seen
as a (minor) bug.  It should be noted somewhere
(at least called out in code comments).

Whether it's important enough to merit mention
in the Elisp manual, I don't know.  Normally
it's not, but someone actually stumbling on this
would need to check the code to discover it and
would need to recognize that it's a bug by design.

File backquote.el says clearly at the outset:

;; When the Lisp reader sees `(...), it generates
;;   (\` (...)).
;;
;; When it sees ,... inside such a backquote form,
;;   it generates (\, ...).
;;
;; For ,@... it generates (\,@ ...).

It's _good_ that it says this.  That's a pretty
clear description of the implementation / design.

(Except that the use of (...) and ... in what the
reader sees doesn't make clear what those stand
for.  Backquote applies to unparenthesized sexps
also.)

It could also usefully say that this doesn't
provide exactly the usual Lisp backquote behavior.
It could call out what we're talking about:
_escaped_ comma is (wrongly) treated as unescaped
comma inside a backquote.  That's the design,
AFAICT, and that's not the traditional behavior
(IIRC).





  parent reply	other threads:[~2023-02-05 15:48 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04 23:23 bug#61281: “`(a \, b)” equals to “`(a . , b)” Xie Shynur
2023-02-04 23:34 ` Drew Adams
2023-02-04 23:43   ` Drew Adams
2023-02-05  0:28   ` Michael Heerdegen
2023-02-05  3:30     ` Drew Adams
2023-02-05  4:32       ` Michael Heerdegen
2023-02-05  4:55         ` Michael Heerdegen
2023-02-05 15:53           ` Drew Adams
2023-02-05 23:56             ` Michael Heerdegen
2023-02-06  2:26               ` Drew Adams
2023-02-06  3:03                 ` Michael Heerdegen
2023-02-06  3:49                   ` Drew Adams
2023-02-06 10:49                 ` Ihor Radchenko
2023-02-06 16:46                   ` Drew Adams
2023-02-07  1:07                     ` Michael Heerdegen
2023-02-07  1:40                   ` Michael Heerdegen
2023-02-07 11:50                     ` bug#61281: Double backquote expansion and ", " (was: bug#61281: “`(a \, b)” equals to “`(a . , b)”) Ihor Radchenko
2023-02-07 23:33                       ` bug#61281: Double backquote expansion and ", " Michael Heerdegen
2023-02-06  9:40               ` bug#61281: “`(a \, b)” equals to “`(a . , b)” Andreas Schwab
2023-02-06 16:43                 ` Drew Adams
2023-02-07  8:56                   ` Andreas Schwab
2023-02-07 18:00                     ` Drew Adams
2023-02-07 23:44                       ` Michael Heerdegen
2023-02-08  3:09                         ` Drew Adams
2023-02-08  9:06                           ` Andreas Schwab
2023-02-09  1:29                           ` Michael Heerdegen
2023-02-09  2:04                             ` Drew Adams
2023-02-09  2:15                               ` Michael Heerdegen
2023-02-08  9:12                       ` Andreas Schwab
2023-02-05  6:32         ` Jim Porter
2023-02-06  0:13           ` Michael Heerdegen
2023-02-06  0:18             ` Michael Heerdegen
2023-02-06  1:14               ` Jim Porter
2023-02-05 15:48         ` Drew Adams [this message]
2023-02-05 23:17           ` Michael Heerdegen
2023-02-06  1:49             ` Drew Adams
2023-02-06  4:11 ` Michael Heerdegen
2023-02-06  5:01   ` Drew Adams
2023-02-06  5:22     ` Drew Adams
2023-02-06  5:25     ` Michael Heerdegen
2023-02-06 16:43       ` Drew Adams
2023-02-07  2:00         ` Michael Heerdegen
2023-02-07 18:00           ` Drew Adams
2023-02-07 23:36             ` Michael Heerdegen
2023-02-08  3:09               ` Drew Adams
2023-02-09  1:37                 ` Michael Heerdegen
2023-02-09  2:10                   ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB54889CF4F61C59C39FDDFEB9F3D59@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=61281@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=one.last.kiss@outlook.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).