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: Michael Heerdegen
Subject: bug#61281: “`(a \, b)” equals to “`(a . , b)”
Date: Mon, 06 Feb 2023 00:56:00 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

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 via email to

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