Subject: Re: bug#75170: add-to-alist: new function

From: Roland Winkler <[email-masked]>
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