GNU bug report logs - #75170
add-to-alist: new function

Previous Next

Package: emacs;

Reported by: Roland Winkler <winkler <at> gnu.org>

Date: Sun, 29 Dec 2024 05:35:02 UTC

Severity: wishlist

Full log


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

From: "Alfred M. Szmidt" <ams <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: winkler <at> gnu.org, monnier <at> gnu.org, 75170 <at> debbugs.gnu.org,
 stefankangas <at> gmail.com, eliz <at> gnu.org, acorallo <at> gnu.org
Subject: Re: bug#75170: add-to-alist: new function
Date: Tue, 21 Jan 2025 06:34:55 -0500
   >>>>> On Tue, 21 Jan 2025 05:33:50 -0500, "Alfred M. Szmidt" <ams <at> gnu.org> said:

       Alfred> Right, so why should map-foo care about such lists?  You're saying it
       Alfred> "expects" them to be alists, but if it gets another list that is not
       Alfred> an alist .. it fails.  That is the same behaviour as rest of Emacs,
       Alfred> no?

   Except that alist-get, assoc, etc donʼt fail (or at least: the
   resulting structure is more coherent than what map-put! produces).

I don't follow, your example with map-put! did not fail just strange
result, which is no different if you use alist/plist specific
functions on thigns that are not plists or alists.

map-put! cannot know if the thing it is stuff things into is a plist,
alist, list ... which is why this type of function can never really be
well behaved.  The alist/plist functions are specially named for that
reason.









This bug report was last modified 142 days ago.

Previous Next


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