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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46754 in the body.
You can then email your comments to 46754 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to nicolas <at> petton.fr, monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#46754; Package emacs. (Wed, 24 Feb 2021 15:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Basil L. Contovounesios" <contovob <at> tcd.ie>:
New bug report received and forwarded. Copy sent to nicolas <at> petton.fr, monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Wed, 24 Feb 2021 15:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; Various map.el fixes and improvements
Date: Wed, 24 Feb 2021 15:15:07 +0000
[Message part 1 (text/plain, inline)]
X-Debbugs-Cc: Nicolas Petton <nicolas <at> petton.fr>, Stefan Monnier <monnier <at> iro.umontreal.ca>
Tags: patch

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?

Thanks,

-- 
Basil

[0001-Various-map.el-improvements.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46754; Package emacs. (Mon, 01 Mar 2021 20:00:02 GMT) Full text and rfc822 format available.

Message #8 received at 46754 <at> debbugs.gnu.org (full text, mbox):

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: Re: 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





Added tag(s) fixed. Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Sat, 06 Mar 2021 17:53:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 46754 <at> debbugs.gnu.org and "Basil L. Contovounesios" <contovob <at> tcd.ie> Request was from "Basil L. Contovounesios" <contovob <at> tcd.ie> to control <at> debbugs.gnu.org. (Sat, 06 Mar 2021 17:53:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46754; Package emacs. (Sat, 06 Mar 2021 17:53:02 GMT) Full text and rfc822 format available.

Message #15 received at 46754-done <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: nicolas petton <nicolas <at> petton.fr>, 46754-done <at> debbugs.gnu.org
Subject: Re: bug#46754: 28.0.50; Various map.el fixes and improvements
Date: Sat, 06 Mar 2021 17:52:16 +0000
tags 46754 fixed
close 46754 28.1
quit

Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

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

Thanks, both points make sense, and I think I addressed them, so I'm
closing this report.

Various map.el improvements
d925121b1e 2021-03-06 16:00:52 +0000
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d925121b1e1cdf953705a5da43f8092f2a6e1d8c

-- 
Basil




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 04 Apr 2021 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 358 days ago.

Previous Next


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