not shold but **does** work ;-) Although I agree that specific thing is very inconvenient in some case and minifiers knows this too.
As example, google closure compiler fails with this script in two ways ```javascript var wm = new WeakMap; wm.delete(Object); ``` Simple minification does the right, resulting in an IE8 safe script such` wm['delete'](Object)` thing but it throws a warning: ``` JSC_INVALID_ES3_PROP_NAME: Keywords and reserved words are not allowed as unquoted property names in older versions of JavaScript. If you are targeting newer versions of JavaScript, set the appropriate language_in option. at line 2 character 3 wm.delete(Object); ``` While in advance mode and no special flags it just breaks resulting in: `(new WeakMap).a(Object);` YUI is not even able to minify that script ... in few words developers tools do not make the usage of these methods in ES6 collections easy to write and use for developers themselves so tey have to remember those square brackets ... pretty silly if you ask me ^_^ ES6#del() or remove() would have been way easier solution ... choosing a reserved word was OKish, but was also asking for few extra gotchas/troubles nobody really needed/wanted. The good part is: nobody will care about IE8 anymore ... and pretty soon!!! Still tools should be smarter about this issue Best Regards On Tue, Dec 17, 2013 at 1:38 AM, David Bruant <[email protected]> wrote: > Le 17/12/2013 10:19, Shijun He a écrit : > > There are some methods using reserved word "delete", such as >> Map.prototype.delete, Set.prototype.delete... Though it is allowed since >> ES5, I think we'd better avoid it because it cause es6 shim solution fail >> on legacy browsers such as IE8. >> > Note that there is a warning [1] (maybe arguably). Among other > incompatibilities, "size" is a getter too. > > myMap.delete fails, but myMap['delete'] should work. > > David > > [1] https://github.com/paulmillr/es6-shim/blob/ > 4322eae20b6f8a7769fa1d89ac207ef8ee9e1ee4/es6-shim.js#L662 > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

