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
> > Then the manual should be corrected to state that much more
> > explicitly than it does now. Perhaps it shouldn't even talk
> > about destructive removal, as that will surely spread
> > confusion. For me "destructive" means "in-place", and no
> > amount of describing how 'delete' works internally will ever
> > be able to countermand that.
>
> Even if the element is not the first one, you always have to
> think about other references that may exist to the cons that
> is removed.
Exactly. That too merits an explicit mention. That is an even more insidious
source of hard-to-find bugs.
There is no harm in driving this point home, even at the risk of some
repetition. Destructive operations should not be used without extra care. It
is a gotcha that newbies sometimes learn the hard way.
In particular, thinking that such operations are only about performance, and
understanding that they can be more performant, newbies sometimes start using
them right off the bat (premature optimization). And because the gotchas only
surface in some situations, they don't necessarily notice problems right away.
IIRC, the Common Lisp manual was pretty good at essentially warning readers not
to use destructive operations unless they really understand them well. I don't
recall just what was said, though.
A simple guideline to set your variable to the list returned by such an
operation will go a long way, I think. But we should of course explain why
also.
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.