A clear method is definitely important for both Map and Set. Our real-world polyfills have also needed them.
What about copying of these new data structures? On Mon, Oct 22, 2012 at 10:40 AM, Brendan Eich <bren...@mozilla.org> wrote: > +1, no brainer. Thanks for supplying the brain! > > /be > > > Jason Orendorff wrote: > >> An actual real-world user of ES6 Map (in Firefox-only code) is asking >> for a .clear() method: >> >> <jcranmer> I'm writing a mork reader in JS for mconley's new >> addressbook (using JS workers, OS.File, and JS Maps !) >> <jcranmer> one of the operations I need to be able to do amounts to >> "clear the entire table" >> <jcranmer> I can't just make it a new map, since I put other >> properties on the map that I don't want to lose >> <jcranmer> I'm doing this for now: >> <jcranmer> for (let [tid, value] of this._currentTable) >> <jcranmer> this._currentTable.delete(tid)**; >> <jorendorff> why store those extra properties on this._currentTable >> rather than directly on this? >> <jcranmer> because I have multiple tables >> >> In our current implementation, a builtin Map.prototype.clear method >> that simply removes all entries from the Map would be quite a bit >> faster than what jcranmer is currently doing. >> >> -j >> ______________________________**_________________ >> es-discuss mailing list >> es-discuss@mozilla.org >> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss> >> >> ______________________________**_________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss> > -- Yehuda Katz (ph) 718.877.1325
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss