GNU bug report logs -
#12314
24.2.50; `add-to-history': use `setq' with `delete'
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Thu, 30 Aug 2012 23:10:01 UTC
Severity: normal
Found in version 24.2.50
Done: Chong Yidong <cyd <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> > The fact that modifying the list pointed to by `b' also
> > modifies the list pointed to by `a' is an advantage for
> > certain kinds of programs.
>
> I fail to see the utility of this. Building code that relies on
> internal implementation details is never a good idea. But that's me;
> please don't bother to argue.
Intentional list modification is not an implementation detail. That is, it
concerns the implementation of your program, of course, but not the
implementation of Lisp itself. You have to know what a given Lisp operation
does (side effects) and what it returns, but not how it is implemented.
My description of this area apparently did not help you.
Perhaps someone else can do better.
You might start here: (elisp) `Modifying Lists'.
You might search there for "share|sharing".
You might also google for, say, "lisp sharing list structure modification".
Looking at some of the hits, I think several should be helpful.
Here's one that might be another place to start:
http://en.wikipedia.org/wiki/Lisp_(programming_language)#Shared_structure
Perhaps you can imagine a complex program with a humongous graph structure
(already you see some sharing), which is dynamically modified. Imagine
different views (e.g., variables) into various parts of that structure. This
kind of Lisp program is not uncommon in some applications. (The same could be
done using Java or C or whatever, but Lisp is good for doing things with lists.)
Lisp is not a purely functional language. You need not like that, and you are
not forced to use `setf' etc. when programming in Lisp. But such operations are
a part of Lisp, and they are used by some Lisp programs. They are not a
mistake, but it is possible to make mistakes when using them.
This bug report was last modified 12 years and 251 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.