Subject: Re: bug#47368: 28.0.50; map-elt returns nil without "deprecated" TESTFN

From: "Basil L. Contovounesios" <[email-masked]>
Date: Wed, 24 Mar 2021 23:24:49 +0000

dalanicolai <[email-masked]> writes:

> The docstring of the map-elt function from the map.el package (version
> 3.0) mentions that TESTFN is deprecated because "its default depends on
> the MAP argument". However when I try e.g.
>
> (map-elt '(("A1" . 3)) "A1")
>
> it returns nil.

This is expected, as alist keys are tested with eq by default.

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.

Hash tables, OTOH, are limited to the test function that they were
created with.

So TESTFN doesn't always work as expected depending on the map type.

> When I add the correct TESTFN
>
> (map-elt '(("A1" . 3)) "A1" nil 'string=)
>
> it does correctly return 3.
>
> So it seems to me that TESTFN is not yet deprecated, or that otherwise I
> am understanding it incorrectly.

Deprecation means "this is not recommended" and "support for this may be
removed in a future version".

So to me TESTFN seems to be working as intended.

> In that case I would label this as a documentation bug.

What would you like to see clarified in the documentation?

Thanks,

-- 
Basil