Subject: RE: bug#12314: 24.2.50; `add-to-history': use `setq' with `delete'

From: "Drew Adams" <[email-masked]>
Date: Sun, 9 Sep 2012 10:35:21 -0700

> > >> Because it avoids memory allocation.  I.e. 99% of the uses of
> > >> delete/delq/nconc are simple optimizations.
> > >
> > > I meant "why does it matter FOR THE USER that the modification was
> > > destructive?"  Users don't care about optimizations, they 
> > > only care about performance.
> > 
> > Because this optimization improves performance,
> 
> But this optimization was already done.

??

> We don't tell users in the manuals about each and every
> optimization we do to improve performance, do we?

Eli, at the risk of butting in, I respectfully suggest that you might not be
reading about this topic well enough or perhaps not thinking enough about it.
The replies to you are now repetitive because there is not much more that can be
said in response.

Stefan is making the point that when programmers use `delete' or `delq' or
`nconc' they often do so to improve the performance of their code.  Which is
true.

We document what these functions do, including the fact that because of what
they do they can often improve performance.  And we mention caveats that users
of such functions need to be aware of.

This is not about any optimization that "we" do in implementing Emacs, i.e.,
something that Emacs does in its implementation, under the covers.

This is about an intentional optimization that some Lisp programmers sometimes
use in their own code.  You can use destructive operations like `delete' to
improve performance, but if you do so then you should be aware of some possible
pitfalls.  That's all.