bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34708: alist-get has unclear documentation


From: Michael Heerdegen
Subject: bug#34708: alist-get has unclear documentation
Date: Tue, 05 Mar 2019 13:35:51 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eric Abrahamsen <eric@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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]