[m-rev.] Bug in API documentation
Julien Fischer
jfischer at opturion.com
Wed Nov 12 13:47:14 AEDT 2025
On Wed, 12 Nov 2025 at 01:37, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
>
> On Tue, 11 Nov 2025 19:37:31 +1100, Julien Fischer <jfischer at opturion.com> wrote:
> > > I'm missing in multi_map (and one_or_more_map) a method of getting all the
> > > values corresponding to a key, which returns an empty list, when there are
> > > none, instead of failing or throwing an exception.
> >
> > For multi_maps, lookup returns an empty list if there are no values
> > corresponding
> > to a key. (It throws an exception if the key is *not* present in the
> > multi_map, which
> > is a different thing.)
>
> Actually, if multi_map.search or multi_map.lookup ever returns an empty list,
> then that means that there is a bug in the multi_map module, because it *should*
> enforce the invariant that no key is mapped to the empty list of values.
The bug is that multi_map is not an abstract type and I can use the operations
from the map module to insert an empty list into a multi_map (which search and
and lookup will dutifully return).
Julien.
More information about the reviews
mailing list