Subject: bug#47425: [External] : Re: bug#47425: 26.3; `plist-get', `plist-put' should accept a TEST function

From: Drew Adams <[email-masked]>
Date: Sun, 28 Mar 2021 16:43:19 +0000

> > Please consider adding a TEST comparer arg for plist keys.
> >
> > In Elisp, a plist key need not be a symbol:
> >
> > (plist-put (list "aaa" 1 "bbb" 2 "ccc" 3) "bbb" 42)
> >
> > That "works" (and no error), but it doesn't do what's expected, since
> > the keys should be compared with `equal' or `string=', not `eq'.
> 
> plist-put doesn't ensure that the operation makes sense here, no, but we
> can't really add that at this point, either.

Please elaborate.  I don't know what you're saying,
or why.

> I think adding a comparison function makes sense, but on the other
> hand -- we seem to be moving towards using map.el more for these things
> now, so I'm not sure there's much enthusiasm for that.  On the other
> hand, the generic map functions have the problem that they...  can't
> really be used like plist-put.

No.  Please do _not_ bring generic mapping into this.
This is a legitimate issue about plists and plist
functions.

> So does anybody have an opinion here?  I think I'm in favour of adding a
> comparison function for all three `plist-*' functions.

+1. 

> > That would also mean we wouldn't need `lax-plist-*' functions.
> 
> Yes, those are horrible functions, and are barely used anywhere.  (And
> `lax-plist-member' is missing.)

Agreed.  But their existence is an argument that the
intention was to provide for the use of `equal' as
an alternative test pred to `eq'.