Subject: Re: add-to-alist: new function

From: Stephen Gildea <[email-masked]>
Date: Tue, 21 Jan 2025 19:57:16 -0800

Looking at Stefan Monnier's set of things to modify and
remember for unloading, I made a list of things to extend
and the syntax for doing so:

list      (add-to-list OBJECT ELEMENT)
alist     (add-to-alist OBJECT (KEY . VALUE))
plist     (put OBJECT KEY VALUE)
hooks     (add-hook OBJECT FUNCTION)
function  (define-advice OBJECT ...)

Seeing these all together, I have the following observations:

Mostly these take the name of the object as a quoted symbol.
'define-advice' doesn't require the name to be quoted, and it
also has a name starting with "def", so the leading "def" is a
good clue as to whether you need to quote the object's name.

'add-to-alist' should look more like 'put' (3 args) and less
like 'add-to-list' (2 args):  (add-to-alist ALIST KEY VALUE).

We should be consistent about whether there is a "to" in the
middle of the name.  'add-to-list' and 'add-to-alist' refer to
the set we are adding to, but 'add-hook' and 'define-advice'
refer to the thing we are adding.  'put' has no noun at all;
if we add a function that supports unloading, it might be
clearer to call it 'add-to-plist'.

 < Stephen