GNU bug report logs - #62068
29.0.60; map-elt and map-insert for nested structures

Previous Next

Package: emacs;

Reported by: Augusto Stoffel <arstoffel <at> gmail.com>

Date: Thu, 9 Mar 2023 08:17:02 UTC

Severity: normal

Found in version 29.0.60

Full log


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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Augusto Stoffel <arstoffel <at> gmail.com>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>,
 Nicolas Petton <nicolas <at> petton.fr>, 62068 <at> debbugs.gnu.org
Subject: Re: bug#62068: 29.0.60; map-elt and map-insert for nested structures
Date: Sat, 11 Mar 2023 04:22:15 +0100
Augusto Stoffel <arstoffel <at> gmail.com> writes:

> How did I miss that?  In any case the more interesting bit is the other
> function, which should then be renamed to `map-nested-insert'.

Is that something one will really need often (honest question, I'm
really curious)?  If yes, I wonder if we should make it work as a
generalized variable.

> Now, `map-nested-elt' has an inconsistency regarding the DEFAULT
> argument which needs to be fixed.
>
> (map-nested-elt '(a nil) '(a) 1)
> 1
> (map-nested-elt '((a . nil)) '(a) 1)
> 1
> etc.
>
> While in the other hand:
> (map-elt '(a nil) 'a 1)
> nil
> (map-elt '((a . nil)) 'a 1)
> nil
> etc.
> [...]

That's a good point indeed.  However, `map-nested-elt' exists since the
beginning of the library in 2015, so it could be that existing code
relies on the behavior (maybe that's why you wanted to add a new
function?).  But it's a terrible inconsistency.

CC'ing also Nicolas.

Should we maybe just add Augusto's version and deprecate the existing
function?


Thanks,

Michael.




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

Previous Next


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