all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Drew Adams <drew.adams@oracle.com>
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: Mon, 06 Feb 2023 00:56:00 +0100	[thread overview]
Message-ID: <87fsbju0of.fsf@web.de> (raw)
In-Reply-To: <SJ0PR10MB5488652C2957D7B8121EE7E7F3D59@SJ0PR10MB5488.namprd10.prod.outlook.com> (Drew Adams's message of "Sun, 5 Feb 2023 15:53:58 +0000")

Drew Adams <drew.adams@oracle.com> writes:

> Dunno.  (read ",foo") and (read ", foo" return
> (\, foo).  Why?  (Just because the current
> implementation of backquote depends on that?)

As I said: any other format would lead to the same "problem", no?
Unless ",X" is something "meta" that has no reader-construct-less
expansion at all.

> (read "'foo") returns just 'foo - it doesn't
> return (quote foo).  (read "`foo") returns
> `foo, not (backquote foo).  (read "`,foo")
> returns `,foo.

You forget that the printer is able to produce this format.  Try `car'.

> Notice the error msg from (eval ',foo):
>
> Debugger entered--Lisp error: (void-function \,)
>   ,foo
>   eval(,foo)
>   (progn (eval ',foo))
>
> Nothing in (normal) Lisp syntax shows the use
> of comma as a function.  ,foo doesn't look
> like function-call syntax, does it?

Another side effect of ,X being equivalent to (\, X.).  That's the only
thing you need to remember.  When you eval that, you should not be
surprised that it's evaluated like ... Lisp evaluates things.

> And here's the error from either (read ",")
> or (eval (read ",")):
>
>  End of file during parsing
>
> Yes, an error should be reported in each case,
> but I think it should just say that comma is
> undefined outside of backquote.

S-exps are defined recursively.  ",X" is read syntax of a valid s-exp,
and I don't think we want to make the reader raise an error for it.  But
the reader expects an expression following the ",".  And a single "," is
_not_the read syntax of the symbol with the name "," (that is "\,":
(symbol-name (read "\\,")) --> ",").

So "End of file during parsing" is an appropriate message: no complete
expression could be read, but something that looks like the start of an
expression.


Ok, so everything is about that you don't want that ,X and (\, X) are
equivalent.  All your arguments were of the kind "the implications are
surprising".  But you never answered the core question: what should ,X
expand to instead that would not have any of these implications?  Else
all you say is that it's surprising when you lack knowledge.


OTOH it seems not easy to find the information ,X == (\, X) somewhere.
Is there a place where there is said something about the kind of
expression the reader construct ,X produces?  I didn't find anything in
a rush.  It should be explained, else this thing indeed can lead to
surprises, as the one reported here.

Michael.





  reply	other threads:[~2023-02-05 23:56 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 [this message]
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
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

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

  git send-email \
    --in-reply-to=87fsbju0of.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=61281@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.