A different semantics for WeakMap#get default value

Andreas Rossberg rossberg at google.com
Wed Jan 18 23:37:44 PST 2012


On 19 January 2012 07:51, 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?

Looks good, except that I don't understand why you want a lazyFactory
function instead of a simple initialValue -- if you recommend
lazyFactory having no observable side effect, then (with no arguments)
it will be a constant function, and you could as well use a plain
value.

On the other hand, a function would be useful if it also got the key
as an argument, so that it can manufacture values in a key-dependent
manner.

/Andreas


More information about the es-discuss mailing list