A different semantics for WeakMap#get default value

Andrea Giammarchi andrea.giammarchi at gmail.com
Thu Jan 19 00:00:07 PST 2012

On Thu, Jan 19, 2012 at 7:51 AM, Mark S. Miller <erights at google.com> wrote:

> Everyone on this thread, is there any need expressed in this thread that
> is not satisfied by InfiniteMap?

I would say for "notification purpose"

result = lazyFactory(key, defaultValue);

would be more appropriate otherwise the defaultValue looses completely its
meaning the moment "key" is not there due the first if.

Out of curiosity, Chrome experimental flag does not support get(key,
defaultValue) but get(key) only ... is this something missing or Map and
WeakMap will never support officially the second get() argument?

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

More information about the es-discuss mailing list