unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: Ivan Andrus <darthandrus@gmail.com>, 40692@debbugs.gnu.org
Subject: bug#40692: 28.0.50; Constant list modified inside  function
Date: Sun, 19 Apr 2020 09:08:37 +0200	[thread overview]
Message-ID: <87d08454wa.fsf@gmail.com> (raw)
In-Reply-To: <87sgh0xvdt.fsf@web.de> (Michael Heerdegen's message of "Sun, 19 Apr 2020 00:49:02 +0200")

On Sun, 19 Apr 2020 00:49:02 +0200
Michael Heerdegen wrote:

> Štěpán Němec <stepnem@gmail.com> writes:
>
>> > Now, I understand reference semantics of lists in general, but it
>> > seems like this should be different. If this behavior is intentional,
>>
>> I think it is, although I admit I was confused by it, too, as I've
>> somehow come to believe that e.g. `(list) macroexpands to (list 'list),
>> but that's not the case: it expands to '(list).
>
> Yes, I had been bitten by this as well some time ago.  I don't find the
> discussion anymore, I had asked somewhere and the answer was that it's
> an intended feature of backquote to produce an expansion like that.

The "optimization" in absence of unquoted terms seems reasonable, and
e.g. SBCL behaves the same.

I find http://www.lispworks.com/documentation/HyperSpec/Body/02_df.htm
somewhat ambiguous, but http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-14.html
is quite clear:

"Semantics: If no unquote or unquote-splicing forms appear within the <qq
template>, the result of evaluating (quasiquote <qq template>) is
equivalent to the result of evaluating (quote <qq template>)."

Also:

"A quasiquote expression may return either fresh, mutable objects or
literal structure for any structure that is constructed at run time
during the evaluation of the expression. Portions that do not need to be
rebuilt are always literal."

-- 
Štěpán





  reply	other threads:[~2020-04-19  7:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17 23:45 bug#40692: 28.0.50; Constant list modified inside function Ivan Andrus
2020-04-18  3:05 ` Ivan Andrus
2020-04-18  9:18 ` Štěpán Němec
2020-04-18 22:49   ` Michael Heerdegen
2020-04-19  7:08     ` Štěpán Němec [this message]
2021-08-29 22:18       ` Lars Ingebrigtsen

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=87d08454wa.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=40692@debbugs.gnu.org \
    --cc=darthandrus@gmail.com \
    --cc=michael_heerdegen@web.de \
    /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).