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

From: "Miguel V. S. Frasson" <mvsfrasson <at> gmail.com>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 34708 <at> debbugs.gnu.org
Subject: Re: bug#34708: alist-get has unclear documentation
Date: Sun, 3 Mar 2019 08:32:45 -0300
[Message part 1 (text/plain, inline)]
Hi

I think the sentence below is a good and short explanation for the
doc-string.

The return value can be conveniently used as a generalized variable (a
place) to set the value associated with KEY in ALIST, like in the example
 (setf (alist-get key alist) new-value)

Miguel


Em sáb, 2 de mar de 2019 15:10, Michael Heerdegen <michael_heerdegen <at> web.de>
escreveu:

> "Miguel V. S. Frasson" <mvsfrasson <at> gmail.com> writes:
>
> > I can't imagine how to *set* anything with alist-get. It seams to me
> > that it just use the value of ALIST for look up, so talk about
> > generalized variables is meaningless to me here.
>
> You use it like this: say variable V is bound to an alist, then you can
> do (setf (alist-get key V) value).  After that, (alist-get key V) will
> evaluate to VALUE, so you have "set" that place.  In the general case, V
> can also be a generalized variable, e.g. (car SOMETHING-ELSE).
>
> To replace the word "this" with something better is not so easy.  We
> could write "The name of this function can be used to build expressions
> that can be used as a generalized variable", but I doubt it will make
> things clearer for somebody not familiar with the concept of generalized
> variables.  Using this function name to build place expressions is not
> different from using other function names that allow to be used for
> generalized variables.
>
> I would rather go with an example, which I think is justified because
> using this function name in place expressions is the canonical way to
> modify alists and people need to use it (there is no `alist-put') no
> matter if they are familiar with generalized variables.
>
> Michael.
>
>
>
[Message part 2 (text/html, inline)]

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.