A different semantics for WeakMap#get default value

Brendan Eich brendan at mozilla.org
Mon Jan 16 13:52:29 PST 2012


Clearly(!) a set-if-not-present method should not be misnamed "get".

I like the optional sentinel-meaning-not-found for get, and setDefault 
per Python as Tab pointed out. Agree they should not be merged into one 
API. Bikeshedding setDefault at leisure (in background in my head ;-).

/be


More information about the es-discuss mailing list