I’m not sure how much this is needed for WeakMaps in particular, but when you 
nest data structures then it’s handy to automatically create an entry if it is 
missing. I’ve seen  collection frameworks where maps have an optional 
constructor argument: a function that auto-creates an entry if it is missing.

But we are entering complex API territory and those decisions might best be 
delegated to whoever creates a collections library for JavaScript.

On Jan 16, 2012, at 22:46 , Mark S. Miller wrote:

> David and Axel, I don't get it. What's wrong with the get with the optional 
> default value, as specified by that text and as currently implemented by FF? 
> What additional value does this contingent mutation add, regardless of how 
> it's packaged? Do you really want "has" to answer true for a key merely 
> because a previous get (or setdefault) with that key caused a default value 
> to be stored? Axel, does this add enough value to expand the API by 25%?

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to