[m-rev.] New library module: default_map.m
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Jul 11 23:02:41 AEST 2001
On 11-Jul-2001, Ralph Becket <rbeck at microsoft.com> wrote:
> > From: Fergus Henderson [mailto:fjh at cs.mu.OZ.AU]
> > Sent: 11 July 2001 13:30
> >
> > Hmm... how about just adding a variant of map__search/map__lookup
> > that takes a default?
>
> Yeah, that would work too :)
>
> > I've needed map__lookup_with_default often enough, but I don't think I've ever
> > needed to store the default in the map.
>
> It seemed the right place to put the default. Augmenting every lookup
> call with the default value looks like a source of bugs to me. If you
> feel strongly, though, I shan't argue - I suspect most places where I've
> wanted this functionality have been fairly localized, so using augmented
> lookups shouldn't be too bad.
Well, I just don't think that this is worth another module, and more
importantly another type with its own set of procedures to go with it.
I can see lots of issues with wanting to call a routine like map__fold
or something like that which is defined only on maps and not on default_maps,
or having to convert between maps and default_maps.
Using a single type avoids those issues.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list