GNU bug report logs - #34708
alist-get has unclear documentation

Previous Next

Package: emacs;

Reported by: "Miguel V. S. Frasson" <mvsfrasson <at> gmail.com>

Date: Sat, 2 Mar 2019 04:52:01 UTC

Severity: minor

Done: Michael Heerdegen <michael_heerdegen <at> web.de>

Bug is archived. No further changes may be made.

Full log


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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Eric Abrahamsen <eric <at> ericabrahamsen.net>
Cc: 34708 <at> debbugs.gnu.org
Subject: Re: bug#34708: alist-get has unclear documentation
Date: Tue, 05 Mar 2019 13:35:51 +0100
Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:

> Thanks for spelling all this out! I guess my confusion is the
> interaction of REMOVE with DEFAULT. Why does REMOVE only do anything
> if the value being set is equal to the DEFAULT? If they are not equal,
> REMOVE is ignored, and the value is set. How does that make sense?

If you do (setf GV V) with some place expression GV and some value V,
you expect that afterwards GV evaluates to V.

If (setf (alist-get key alist nil 'remove) t) would remove the
association of KEY,

  (alist-get key alist nil 'remove)

or

  (alist-get key alist nil)

would not eval to nil, although you have set the place to t.

With other words: removing elements from an alist is something that
doesn't fit 100% to place expressions, so the syntax and semantics you
get are not 100% straightforward.  Not super sexy, but consistent.


Michael.




This bug report was last modified 6 years and 32 days ago.

Previous Next


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