* bug#64537: mix lists and vectors when using backquote
@ 2023-07-09 5:40 Shynur Xie
2023-09-22 9:08 ` Stefan Kangas
2024-06-08 23:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 2 replies; 5+ messages in thread
From: Shynur Xie @ 2023-07-09 5:40 UTC (permalink / raw)
To: 64537
The docstring of ‘backquote’ says “vectors work just like lists”.
Should we also clarify that mixing lists and vectors these 2 way:
`(... ,@[...]) ; by contrast: `(,@[] 1) => (1)
`[,@'()] ; by contrast: `[1 ,@'()] => [1]
will lead to unexpected behavior? Or suggest not doing so? Or let
‘backquote’ detect this and signal an error?
BTW, if [[https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64415]] is
actually not a bug, please consider document that behavior. Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#64537: mix lists and vectors when using backquote
2023-07-09 5:40 bug#64537: mix lists and vectors when using backquote Shynur Xie
@ 2023-09-22 9:08 ` Stefan Kangas
2023-09-22 15:03 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-08 23:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 1 reply; 5+ messages in thread
From: Stefan Kangas @ 2023-09-22 9:08 UTC (permalink / raw)
To: Shynur Xie; +Cc: 64537, Stefan Monnier
Shynur Xie <one.last.kiss@outlook.com> writes:
> The docstring of ‘backquote’ says “vectors work just like lists”.
> Should we also clarify that mixing lists and vectors these 2 way:
>
> `(... ,@[...]) ; by contrast: `(,@[] 1) => (1)
> `[,@'()] ; by contrast: `[1 ,@'()] => [1]
>
> will lead to unexpected behavior? Or suggest not doing so? Or let
> ‘backquote’ detect this and signal an error?
Copying in Stefan Monnier.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#64537: mix lists and vectors when using backquote
2023-09-22 9:08 ` Stefan Kangas
@ 2023-09-22 15:03 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-24 9:47 ` Stefan Kangas
0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-22 15:03 UTC (permalink / raw)
To: Stefan Kangas; +Cc: 64537, Shynur Xie
>> The docstring of ‘backquote’ says “vectors work just like lists”.
>> Should we also clarify that mixing lists and vectors these 2 way:
>>
>> `(... ,@[...]) ; by contrast: `(,@[] 1) => (1)
>> `[,@'()] ; by contrast: `[1 ,@'()] => [1]
>>
>> will lead to unexpected behavior? Or suggest not doing so? Or let
>> ‘backquote’ detect this and signal an error?
>
> Copying in Stefan Monnier.
Is there a good reason why we have those unexpected behaviors?
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#64537: mix lists and vectors when using backquote
2023-09-22 15:03 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-24 9:47 ` Stefan Kangas
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Kangas @ 2023-09-24 9:47 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 64537, Shynur Xie
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> The docstring of ‘backquote’ says “vectors work just like lists”.
>>> Should we also clarify that mixing lists and vectors these 2 way:
>>>
>>> `(... ,@[...]) ; by contrast: `(,@[] 1) => (1)
>>> `[,@'()] ; by contrast: `[1 ,@'()] => [1]
>>>
>>> will lead to unexpected behavior? Or suggest not doing so? Or let
>>> ‘backquote’ detect this and signal an error?
>>
>> Copying in Stefan Monnier.
>
> Is there a good reason why we have those unexpected behaviors?
I see two unexpected behaviors:
1. `(... ,@[...]) => (\... . [\...])
2. `[,@'()] => [(\,@ 'nil)]
I'd say these are the expected values:
1. `(... ,@[...]) => (\... \...)
2. `[,@'()] => []
I don't see any good reason for them, so perhaps these are just plain
bugs to be fixed?
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#64537: mix lists and vectors when using backquote
2023-07-09 5:40 bug#64537: mix lists and vectors when using backquote Shynur Xie
2023-09-22 9:08 ` Stefan Kangas
@ 2024-06-08 23:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-08 23:45 UTC (permalink / raw)
To: Shynur Xie; +Cc: 64537
> `(... ,@[...]) ; by contrast: `(,@[] 1) => (1)
AFAICT this is the result of an optimization:
`(BAR ,@FOO)
is optimized to
`(BAR . ,FOO)
I expect a fair bit of code "relies" on this optimization, so I'm not
sure we want to "fix" it.
> `[,@'()] ; by contrast: `[1 ,@'()] => [1]
This looks like a plain bug (probably linked to another optimization).
`[,@(not t)]
doesn't suffer from this problem but
`[,@'[]]
also suffers from it.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-08 23:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-09 5:40 bug#64537: mix lists and vectors when using backquote Shynur Xie
2023-09-22 9:08 ` Stefan Kangas
2023-09-22 15:03 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-24 9:47 ` Stefan Kangas
2024-06-08 23:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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.