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

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

bug#47368: [External] : bug#47368: 28.0.50; map-elt returns nil without


From: Basil L. Contovounesios
Subject: bug#47368: [External] : bug#47368: 28.0.50; map-elt returns nil without "deprecated" TESTFN
Date: Fri, 26 Mar 2021 20:23:01 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Drew Adams <drew.adams@oracle.com> writes:

>> >> > This is expected, as alist keys are tested with eq by default.
>> >
>> > Since when?
>> 
>> Since the introduction of map.el in Emacs 25.
>
> The general statement you made, that alist keys are treated with eq by
> default, is false, AFAIK.  That may be true of `map-elt', but it's not
> true in general (AFAIK).

This bug report is about map-elt, not alists in general.

>> > Where?  Expected by whom, and by what code?
>> 
>> By the function being discussed.
>
> Does the doc string of the function being discussed, `map-elt' say
> this?  Does it say anything at all about how keys are compared?

It used to, before the TESTFN argument was deprecated.  But the whole
point of this discussion is that one size doesn't fit all, since map-elt
is a generic function that can be adapted to heterogeneous types and
semantics, both within Emacs core and external packages.

> I have only Emacs 27.1 - the latest release available on MS Windows,
> and there the doc string says NADA about how keys are compared.
> Nothing about what it means for "if KEY is not found".
>
> At the very least, if such is still the case then the doc needs to
> updated to specify how keys are compared, IMHO.
>
> I'm hoping that doc more recent than Emacs 27.1 already takes care of
> this.  You say, for example:
>
>    That's what the docstring is trying to warn about:
>    alists default to testing with eq, but can also use
>    eql, equal, or anything else.
>
> I don't see (in 27.1) where the doc string warns about
> any such thing.

"TESTFN is deprecated.  Its default depends on the MAP argument."

> Nothing about eq being the default, and nothing about testing being
> also possible with the others you mention.
>
> Not only that, but the doc string says that TESTFN
> is deprecated, but there's no other mention of TESTFN.
>
> What's TESTFN?  Where is it specified?  It's not part
> of the function signature that's shown.  How can you
> refer to it if there's no indication anywhere here of
> what it is?  This makes no sense to me.

All of these points are already being discussed in this thread.

Patches with improvements are always welcome.

> And why is there this line at the end of the doc string?
>
>   Undocumented
>
> What on earth is that supposed to mean to a reader of
> the `map-elt' doc?

The limitations of and suggestions for improvements to the documentation
generated for generic functions are already discussed elsewhere, and are
not specific to the current issue.

-- 
Basil





reply via email to

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