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 #56 received at 34708 <at> debbugs.gnu.org (full text, mbox):

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 34708 <at> debbugs.gnu.org
Subject: Re: bug#34708: alist-get has unclear documentation
Date: Mon, 04 Mar 2019 14:49:15 -0800
On 03/04/19 19:22 PM, Michael Heerdegen wrote:

[...]

> This makes a call like
>
> (setf (alist-get key alist default) default)
>
> ambiguous: the "goal" (which is making (alist-get key alist default)
> eval to DEFAULT) can be reached in two ways: (1) by making KEY being
> associated with DEFAULT in ALIST and (2) by removing any existing
> association for KEY.
>
> You can choose which behavior you want via the REMOVE argument which
> comes after the DEFAULT arg: specifying REMOVE non-nil gives you (2) -
> remove it - else you get (1).

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?




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.