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


Message #97 received at 75170 <at> debbugs.gnu.org (full text, mbox):

From: Roland Winkler <winkler <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 75170 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, acorallo <at> gnu.org,
 stefankangas <at> gmail.com
Subject: Re: bug#75170: add-to-alist: new function
Date: Mon, 20 Jan 2025 13:12:20 -0600
On Mon, Jan 20 2025, Robert Pluim wrote:
> Iʼm not sure what this would offer over
>
>     (setf (alist-get key alist) value)
>
> which will add a key->value mapping if it doesnʼt exist, and replace
> it if it does. I also donʼt see a real use for retaining the existing
> mapping: `alist-get' will return the first one anyway.

By now, this approach has been proposed in this thread a few times.
The question is: this uses the concept of generalized variables.
Is this a concept we recommend to users for their init files?
To the best of my knowledge, previously this has not been the case.
I am tempted to argue that in our recommendations what users should
do in their init files, we should stick to strategies that are as
simple and transparent as possible, and the above does not match
that criterion.  A collection of functions we recommend to users for
their init files might be a good thing.  add-to-list already serves
that specific purpose, and add-to-alist could be another one.

Roland




This bug report was last modified 143 days ago.

Previous Next


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