unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: Nicolas Petton <nicolas@petton.fr>,
	47425@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#47425: 26.3; `plist-get', `plist-put' should accept a TEST function
Date: Sun, 28 Mar 2021 15:12:40 +0200	[thread overview]
Message-ID: <87v99b5smv.fsf@gnus.org> (raw)
In-Reply-To: <SA2PR10MB44746CB6AF01CFEDC7844E67F3619@SA2PR10MB4474.namprd10.prod.outlook.com> (Drew Adams's message of "Fri, 26 Mar 2021 22:13:42 +0000")

Drew Adams <drew.adams@oracle.com> writes:

> 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.

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.  Sure

(map-put! (list 'a 1) 'b 2)

works fine, but you can't create a plist that way, which makes these
functions barely usable at all for handling plists/alists:

(map-put! nil 'b 2)

will signal an error.

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

Drew Adams <drew.adams@oracle.com> writes:

> 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.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  parent reply	other threads:[~2021-03-28 13:12 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 22:13 bug#47425: 26.3; `plist-get', `plist-put' should accept a TEST function Drew Adams
2021-03-26 22:16 ` Drew Adams
2021-03-27  7:16 ` Jean Louis
2021-03-28 13:12 ` Lars Ingebrigtsen [this message]
2021-03-28 16:43   ` bug#47425: [External] : " Drew Adams
2021-03-28 19:20   ` Philipp
2021-03-28 19:27     ` Lars Ingebrigtsen
2022-06-27 10:22       ` Lars Ingebrigtsen
2022-06-27 11:31 ` Mattias Engdegård
2022-06-27 11:43   ` Lars Ingebrigtsen
2022-06-27 12:18     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-27 12:27       ` Mattias Engdegård
2022-06-27 12:44         ` Lars Ingebrigtsen
2022-06-27 13:28           ` Mattias Engdegård
2022-06-27 13:35             ` Lars Ingebrigtsen
2022-06-27 15:11               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-27 15:18                 ` Lars Ingebrigtsen
2022-06-27 14:39             ` Drew Adams
2022-06-27 14:39         ` Drew Adams
2022-06-27 12:41       ` Lars Ingebrigtsen
2022-06-27 14:39         ` Drew Adams
2022-06-27 14:39       ` Drew Adams
2022-06-27 15:09         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-27 17:07           ` Drew Adams
2022-06-27 17:19             ` Mattias Engdegård
2022-06-27 17:22               ` Lars Ingebrigtsen
2022-06-28 15:23                 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-28 15:40                   ` Lars Ingebrigtsen
2022-06-29  3:33                 ` bug#47425: 26.3; `plist-get', `plist-put' and proposed " Richard Stallman
2022-06-29  5:11                   ` Drew Adams
2022-06-30  3:10                     ` Richard Stallman
2022-06-27 17:41               ` bug#47425: 26.3; `plist-get', `plist-put' should accept a " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v99b5smv.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=47425@debbugs.gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=nicolas@petton.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).