GNU bug report logs - #75170
add-to-alist: new function

Previous Next

Package: emacs;

Reported by: Roland Winkler <winkler <at> gnu.org>

Date: Sun, 29 Dec 2024 05:35:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: Roland Winkler <winkler <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 75170 <at> debbugs.gnu.org
Subject: bug#75170: add-to-alist: new function
Date: Tue, 21 Jan 2025 23:09:42 -0600
On Tue, Jan 21 2025, Stefan Monnier wrote:
> I don't have much to add to this discussion except:
>
> - I personally dislike `add-to-list` because I think that conflating
>   symbols with variables is a bad practice (e.g. because it is
>   incompatible with lexical scoping).
>
> - Yet, it works OK for configuration, which always involves
>   global/dynamic variables anyway, and where `push` is not great and
>   `cl-pushnew` often requires `:test #'equal`.
>
> - I think we should try and provide better support (in general) for
>   unloading packages, and this means improving support for undoing
>   top-level operations.  We currently support `defalias` and friends
>   fairly well, `defvar` and friends tolerably, but we fail miserably for
>   most other things.  So maybe something like an `add-to-alist` dedicated
>   to top-level operations, which records the change somewhere
>   (e.g. `load-history`) so we can undo it when unloading, would be
>   an improvement.  Of course it would make a lot of sense to do it
>   together with similar operations to add an element to a list, to add
>   a property to a symbol, to add an advice, to add a function on a hook,
>   ... so it's probably worth thinking of a more general way to provide
>   those operations than doing it one at a time.

In an ideal world, the last item in your list would be great.  But if
dreaming of an ideal world should imply that nothing is going to improve
in a foreseeable future, then I am in favor of less-than-ideal solutions
that can be implemented more easily.




This bug report was last modified 142 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.