GNU bug report logs - #35206
[PATCH] Misleading `list-get' argument description

Previous Next

Package: emacs;

Reported by: Mattias Engdegård <mattiase <at> acm.org>

Date: Tue, 9 Apr 2019 10:35:02 UTC

Severity: normal

Tags: patch

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Mattias Engdegård <mattiase <at> acm.org>
Subject: bug#35206: closed (Re: bug#35206: [PATCH] Misleading `list-get'
 argument description)
Date: Tue, 09 Apr 2019 15:00:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#35206: [PATCH] Misleading `list-get' argument description

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 35206 <at> debbugs.gnu.org.

-- 
35206: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=35206
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35206-done <at> debbugs.gnu.org
Subject: Re: bug#35206: [PATCH] Misleading `list-get' argument description
Date: Tue, 9 Apr 2019 16:59:48 +0200
9 apr. 2019 kl. 16.41 skrev Eli Zaretskii <eliz <at> gnu.org>:
> 
>  Find an element of ALIST whose `car' equals KEY and return its `cdr'.
>  ...
>  Equality with KEY is tested by TESTFN, defaulting to `eq'.

Thank you, I pushed that change (except that I used "the first element" instead of "an element" for precision).

> 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.)

That's all right -- I was mainly concerned with the quite misleading TESTFN description, and looked at the docs of similar functions (assq, assoc).


[Message part 3 (message/rfc822, inline)]
From: Mattias Engdegård <mattiase <at> acm.org>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Misleading `list-get' argument description
Date: Tue, 9 Apr 2019 12:34:09 +0200
[Message part 4 (text/plain, inline)]
The doc string for `list-get' says

  Use TESTFN to lookup in the alist if non-nil.  Otherwise, use `assq'.

which is misleading since it's an equality predicate, not a look-up function, and the default is `eq', not `assq'.
How about changing it to

  Equality is defined by TESTFN or by `eq' if nil or omitted.
[0001-Clarify-the-TESTFN-argument-to-alist-get.patch (application/octet-stream, attachment)]

This bug report was last modified 6 years and 47 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.