From: Eli Zaretskii <eliz@gnu.org>
To: "Mattias Engdegård" <mattiase@acm.org>
Cc: 35206@debbugs.gnu.org
Subject: bug#35206: [PATCH] Misleading `list-get' argument description
Date: Tue, 09 Apr 2019 17:41:28 +0300 [thread overview]
Message-ID: <83a7gz6y1z.fsf@gnu.org> (raw)
In-Reply-To: <75D164EF-3F6F-4E45-ADCB-7A6C25DF4453@acm.org> (message from Mattias Engdegård on Tue, 9 Apr 2019 13:45:34 +0200)
> From: Mattias Engdegård <mattiase@acm.org>
> Date: Tue, 9 Apr 2019 13:45:34 +0200
> Cc: 35206@debbugs.gnu.org
>
> >
> > Comparison of KEY against the car of each ALIST element
> > is made using TESTFN, or `eq' if nil or omitted.
>
> If no knowledge whatsoever of alists can be assumed on the part of the reader, perhaps this would be better:
>
> "Return the value associated with KEY in ALIST.
> +The value is the cdr of the first element in ALIST whose car is equal to KEY.
> If KEY is not found in ALIST, return DEFAULT.
> -Use TESTFN to lookup in the alist if non-nil. Otherwise, use `assq'.
> +Equality is defined by TESTFN or by `eq' if nil or omitted.
This is much better, IMO. It is better than your previous proposal,
because the text is simpler and thus more clear.
However, a slight rewording would improve it even more:
Find an element of ALIST whose `car' equals KEY and return its `cdr'.
...
Equality with KEY is tested by TESTFN, defaulting to `eq'.
IMO, this isn't about assuming knowledge, this is about being as
explicit as reasonably possible about what the function does.
(Strictly speaking, both your suggestion and mine still assume some
knowledge about alists, because we never explain what is an alist, nor
what is an "element" of an alist.)
Thanks.
next prev parent reply other threads:[~2019-04-09 14:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-09 10:34 bug#35206: [PATCH] Misleading `list-get' argument description Mattias Engdegård
2019-04-09 11:00 ` Eli Zaretskii
2019-04-09 11:26 ` Mattias Engdegård
2019-04-09 11:45 ` Mattias Engdegård
2019-04-09 14:41 ` Eli Zaretskii [this message]
2019-04-09 14:59 ` Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83a7gz6y1z.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=35206@debbugs.gnu.org \
--cc=mattiase@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).