A different semantics for WeakMap#get default value

Andrea Giammarchi andrea.giammarchi at gmail.com
Thu Jan 19 09:24:48 PST 2012


On Thu, Jan 19, 2012 at 6:11 PM, Mark S. Miller <erights at google.com> wrote:
>
>
> That's not quite true in the collection I posted, since an InfiniteMap is
> only *initially* total. It still emulates deletes by using tombstones to
> poke holes into its initially universal domain. When doing a get at a
> deleted key, the defaultValue would come into effect.
>

got it, my concern was mainly about the very first case where defaultValue
is not even considered and we have two completely different behaviors if we
get before or after a key has been set ... no way to use the lazyFactory(key,
defaultValue) { ... do stuff and return defaultValue }, if necessary, in
order to be able to instantly set that default ( I just find weird this
"need to delete first, then get default after" )

Hope you got what I mean

br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120119/e81b3947/attachment-0001.html>


More information about the es-discuss mailing list