unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: 23417@debbugs.gnu.org
Subject: bug#23417: 25.1.50; Elisp manual: document gotcha about new objects and quoting
Date: Sun, 28 Jul 2019 17:04:42 +0200	[thread overview]
Message-ID: <877e82b3p1.fsf@mouse.gnus.org> (raw)
In-Reply-To: <20863a98-6b56-409a-9d77-842b39dfd39c@default> (Drew Adams's message of "Sun, 1 May 2016 14:09:05 -0700 (PDT)")

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

> In the Elisp manual, we do, in node `Rearrangement', point out the
> gotcha that a quoted list sexp does not necessarily return a new list
> (new cons) each time it occurs in code.
>
> However:
>
> 1. The gotcha is more general than the nconc context where it is
> presented.  It is not limited to using a quoted constant list as a
> non-last arg to nconc.
>
> 2. The gotcha is not limited to quoted constant lists.  It applies
> to #s also.

The test case is this:

(defun foo ()
  #s(hash-table test eql))

(eq (foo) (foo))
=> t

> 3. Please consider presenting the gotcha in general terms, somewhere.
> And that place can then be cross-referenced from relevant nodes (e.g.
> `Quoting' and `Creating Hash').

I thought we already specified (somewhere in the manual) that a quoted
list often doesn't give us a new list, but after looking around for
seven seconds, I can't find it.  What section would this info go in?

> 4. Please correct misleading text, such as this from `Creating Hash',
> so as not to give the impression that you get a new object for each
> occurrence of a quoted constant.
>
>    You can also create a new hash table using the printed
>    representation for hash tables.
>
> Here is one example of confusion wrt the gotcha for #s:
> http://stackoverflow.com/q/36964728/729907

Yes, that seems pretty misleading -- the natural interpretation of that
(and the example) is that you can use it exactly as is done in that code
snippet.  Which you can't.  Does anybody want to rephrase the "Creating
Hash" node in hash.texi?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2019-07-28 15:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-01 21:09 bug#23417: 25.1.50; Elisp manual: document gotcha about new objects and quoting Drew Adams
2019-07-28 15:04 ` Lars Ingebrigtsen [this message]
2021-02-07 13:48   ` 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=877e82b3p1.fsf@mouse.gnus.org \
    --to=larsi@gnus.org \
    --cc=23417@debbugs.gnu.org \
    --cc=drew.adams@oracle.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).