GNU bug report logs - #46754
28.0.50; Various map.el fixes and improvements

Previous Next

Package: emacs;

Reported by: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Date: Wed, 24 Feb 2021 15:16:02 UTC

Severity: normal

Tags: fixed, patch

Found in version 28.0.50

Fixed in version 28.1

Done: "Basil L. Contovounesios" <contovob <at> tcd.ie>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 46754 <at> debbugs.gnu.org, nicolas petton <nicolas <at> petton.fr>
Subject: bug#46754: 28.0.50; Various map.el fixes and improvements
Date: Mon, 01 Mar 2021 14:59:27 -0500
> 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





This bug report was last modified 4 years and 160 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.