bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23417: 25.1.50; Elisp manual: document gotcha about new objects and


From: Lars Ingebrigtsen
Subject: bug#23417: 25.1.50; Elisp manual: document gotcha about new objects and quoting
Date: Sun, 28 Jul 2019 17:04:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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

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