unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 46754@debbugs.gnu.org, nicolas petton <nicolas@petton.fr>
Subject: bug#46754: 28.0.50; Various map.el fixes and improvements
Date: Mon, 01 Mar 2021 14:59:27 -0500	[thread overview]
Message-ID: <jwvy2f6odgt.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87zgztcxac.fsf@tcd.ie> (Basil L. Contovounesios's message of "Wed, 24 Feb 2021 15:15:07 +0000")

> The attached patch for map.el and seq.el was initially motivated by the
> fact that (map--plist-p '(nil 1)) currently returns nil, whereas I'd
> expect an alist to begin with a cons.
>
> Along the way I noticed some other inconsistencies, such as map-do
> returning non-nil for alists, and the use of 5-arg alist-get when map.el
> expects Emacs 25; and edge cases such as an OBOE on arrays in
> map-delete.
>
> Throughout the patch I assume that cl-defgeneric is generally preferred
> over map--dispatch, except where some aspect of the latter can't be
> matched by the former, e.g. the use of advertised-calling-convention.
>
> WDYT?

Looks fine to me.  I wouldn't advertise the default `map-insert`
implementation too much (especially not saying "it works for arrays and
hash-tables"), since its performance makes it undesirable (and it is
not specific to hash-tables nor arrays).

> -In the base definition, MAP can be an alist, hash-table, or array."
> +In the base definition, MAP can be a list, hash-table, or array."

A list isn't a map, so I think it would be better to write "alist/plist" or
somesuch to avoid giving the impression that lists can be treated as
maps in general.


        Stefan






  reply	other threads:[~2021-03-01 19:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 15:15 bug#46754: 28.0.50; Various map.el fixes and improvements Basil L. Contovounesios
2021-03-01 19:59 ` Stefan Monnier [this message]
2021-03-06 17:52   ` Basil L. Contovounesios

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=jwvy2f6odgt.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=46754@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --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).