[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: |
Sun, 03 Mar 2019 13:50:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Phil Sainty <psainty@orcon.net.nz> writes:
> Agreed. I think the remove syntax is all but unreadable:
>
> (setf (alist-get KEY LIST t t) t)
>
> to remove items from LIST with key eq to KEY.
>
> Unless accompanied by comments, I do not think that meaning obvious
> at all.
>
> This variant gives a better idea...
>
> (setf (alist-get KEY LIST :remove :remove) :remove)
Yes, the syntax is a bit weird. I think I would prefer to write it as
(setf (alist-get key my-alist nil 'remove) nil)
The syntax also makes some sense: If you set the association of KEY to
the default that `alist-get' would return when the entry would not be
not found, the entry can be removed. But I agree we should add such an
example, since not everybody wants to meditate over why this makes sense
in order to remember the syntax.
Michael.
- bug#34708: alist-get has unclear documentation, Miguel V. S. Frasson, 2019/03/01
- bug#34708: alist-get has unclear documentation, Miguel V. S. Frasson, 2019/03/02
- bug#34708: alist-get has unclear documentation, Eric Abrahamsen, 2019/03/02
- bug#34708: alist-get has unclear documentation, Miguel V. S. Frasson, 2019/03/03
- bug#34708: alist-get has unclear documentation, Michael Heerdegen, 2019/03/03
- bug#34708: alist-get has unclear documentation, Drew Adams, 2019/03/03
- bug#34708: alist-get has unclear documentation, Eric Abrahamsen, 2019/03/03
- bug#34708: alist-get has unclear documentation, Eric Abrahamsen, 2019/03/04
- bug#34708: alist-get has unclear documentation, Michael Heerdegen, 2019/03/04
- bug#34708: alist-get has unclear documentation, Eric Abrahamsen, 2019/03/04