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

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

Re: replacing a certain element in a list with another


From: Oliver Scholz
Subject: Re: replacing a certain element in a list with another
Date: Sat, 25 Oct 2003 13:25:24 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3.50 (gnu/linux)

Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

> Barry Margolin <barry.margolin@level3.com> writes:
>
>> The verbose documentation of all the destructive list operations should
>> mention that you must use the value to get the expected results all the
>> time, rather than depending on everything to work due to the lists being
>> modified in place.
>
> The first part of your sentence is exactly my point. Unlike the
> docstring of nreverse, the info node presently does not say
> explicitely that it is the _return_ value that should be used. 

I agree that this could be more verbose. It is not, however,
undocumented as you seem to imply. I want to note---by the way---that
in my esteem destructive operations ship with a big sign on them:
“Dangerous! Handle with caution!”

> (It is hidden only implicitely in the sentence: "To avoid confusion,
> we usually store the result of `nreverse' back in the same variable
> which held the original list.")

I think that sentence is meant to say “... back in the same variable
which held the original list rather than in *another*
variable. Because that original variable may still be around and you
could become heavily confused when you try to debug your program and
wonder why on earth your variable has such a very weird unexpected
value at some point. On the other hand that's what you get for
careless use of destructive functions ...”

[...]
> The last two lines I find confusing because they use the argument of
> nreverse after it was passed to nreverse.
[...]

Confusion is always bad. I think you are right, that this should be
more verbose. Please send a bug report: (info "(elisp)Caveats").

    Oliver
-- 
4 Brumaire an 212 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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