Re: Could delete methods rename to remove?

2013-12-18 Thread Shijun He
On Wed, Dec 18, 2013 at 1:55 PM, Rick Waldron waldron.r...@gmail.comwrote:


 Submit patches—libraries intended for use in IE8 should be made to support
 that platform, it's that simple.


Submitting patches is irrelevant and impractical here.

Why use es5-shim? Because we want to use some scripts written in es5
WITHOUT asking the authors change their code. Though sometimes es5-shim is
not enough (for those rely on getter/setter syntax or Object.create(null)
which hard to shim).

What I'm talking about is: there will be many modules using ES6 API but
still can be used in ES5 or pre-ES5 or even pre-ES3 environment with
es5/es6 shims (if they do not rely on the complex features like Proxy or
Generator). So bordering the original authors to change their code from
a.delete() to a['delete'] are meaningless and I don't expect they will
accept such patch. (Do anyone really think change a.delete to a['delete']
is a patch?)



  Wrong—that impairment has nothing to do with browsers, but with
 _existing_ code that makes incorrect assumptions (or none at all) about the
 return value of typeof.


I don't see any difference here. Whether it's correct or incorrect
assumption, the spec can not change that behavior. In my opinion, using
reserved words as methods name in standard library is far more problematic
than the case of typeof null (because I don't know any real product code
rely on typeof null === 'object' and if any it's very easy to fix).
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-18 Thread David Bruant

Le 17/12/2013 22:52, Alex Kocharin a écrit :
 I believe ecmascript isn't versionless yet like html is, and that 
number means something.
As far as I'm concerned, ECMAScript is versionless. As versionless as 
HTML. Implementation aren't monolithically moving from one standard 
version to the other. I don't believe we've ever seen a browser with 
exactly ES3 or exactly ES5 (wait... maybe IE10?! but with IE11, they're 
back to ES5+some ES6 features)
Modulo spec bugs and history details, version n is fully 
backward-compatible with version n-1.

TC39 decided to move to a more iterative spec release schedule recently too.
The version has also never been exposed to the runtime which encourages 
people to do version-agnostic feature detection.


Version numbers mean nothing. Version numbers are kept only for the same 
reason W3C produces HTML5 and 5.1 and 6 spec. And I think the reason 
is that most people aren't used to how the web works and are reassured 
with classic versioning systems... so reassured some people pay a 
different price to the same company when they're sold a HTML4 site or an 
HTML5 site (because 5  4, you know...). True story.


Maybe versions is just better marketing because in the next version 
suggests a stronger progress than in the next iteration?


David
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Could delete methods rename to remove?

2013-12-17 Thread Shijun He
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.



--
hax
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread David Bruant

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
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Rick Waldron
On Tue, Dec 17, 2013 at 4:19 AM, Shijun He hax@gmail.com wrote:

 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.


As Allen has said in the past: The future is bigger than the past. The
method name delete is compatible with the previous version of the
specification—which is not at all ambiguous or underspecified w/r to
Identifier and IdentifierName static semantics.

Rick
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Andrea Giammarchi
sorry what ?

https://github.com/WebReflection/es6-collections#es6-harmony-collections-fast-polyfill
https://code.google.com/p/es-lab/source/browse/trunk/src/ses/WeakMap.js
https://github.com/Benvie/ES6-Harmony-Collections-Shim
https://github.com/paulmillr/es6-shim
https://gist.github.com/Gozala/1269991

regards



On Tue, Dec 17, 2013 at 11:38 AM, Alex Kocharin a...@kocharin.ru wrote:


 ES6 scripts will not work in IE8. Period. What's the point of making it
 work with a bit more ES6 scripts since all of them will never be supported
 anyway?

 I would only welcome if that badly written or outdated software gets
 exposed this way.


 17.12.2013, 22:59, Andrea Giammarchi andrea.giammar...@gmail.com:

 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 bruan...@gmail.com 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
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss

 ,

 ___
 es-discuss mailing list
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss


 ___
 es-discuss mailing list
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss


___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Andrea Giammarchi
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 bruan...@gmail.com 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
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss

___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Alex Kocharin
 You can't run any ES6 script in a browser that don't support ES6, because they will throw syntax error at the first yield (unless you're using compiler like traceur, but it won't have a problem with getting .delete work either). If you use shims, that's fine, but you're not writing ES6, you're writing ES5+shims, and that's not ES6 because you can't use all the features it introduces. I believe ecmascript isn't versionless yet like html is, and that number means something. If you want to support IE6 without compiling, fine, you can write in ES3+shims using wm['delete'](object) syntax. I don't see it being an issue.  18.12.2013, 00:59, "Andrea Giammarchi" andrea.giammar...@gmail.com:sorry what ? https://github.com/WebReflection/es6-collections#es6-harmony-collections-fast-polyfillhttps://code.google.com/p/es-lab/source/browse/trunk/src/ses/WeakMap.jshttps://github.com/Benvie/ES6-Harmony-Collections-Shimhttps://github.com/paulmillr/es6-shimhttps://gist.github.com/Gozala/1269991 regards On Tue, Dec 17, 2013 at 11:38 AM, Alex Kocharin a...@kocharin.ru wrote: ES6 scripts will not work in IE8. Period. What's the point of making it work with a bit more ES6 scripts since all of them will never be supported anyway? I would only welcome if that badly written or outdated software gets exposed this way.  17.12.2013, 22:59, "Andrea Giammarchi" andrea.giammar...@gmail.com: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 RegardsOn Tue, Dec 17, 2013 at 1:38 AM, David Bruant bruan...@gmail.com 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 es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss,___es-discuss mailing listes-discuss@mozilla.orghttps://mail.mozilla.org/listinfo/es-discuss___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss ___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Alex Kocharin
 ES6 scripts will not work in IE8. Period. What's the point of making it work with a bit more ES6 scripts since all of them will never be supported anyway? I would only welcome if that badly written or outdated software gets exposed this way.  17.12.2013, 22:59, "Andrea Giammarchi" andrea.giammar...@gmail.com: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 RegardsOn Tue, Dec 17, 2013 at 1:38 AM, David Bruant bruan...@gmail.com 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 es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss,___es-discuss mailing listes-discuss@mozilla.orghttps://mail.mozilla.org/listinfo/es-discuss___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Andrea Giammarchi
IE6 ? ... I don't understand your argument. We are talking about IE8 and
polyfills that work already plus this does not solve the main problem which
is about tools not always compatible with ES6 and/or future proof and shim
aware.

If tools were OK you wuld just write wm.delete(obj); and the tool would
wrap that for you instead of throwing as these might do today.

Regards


On Tue, Dec 17, 2013 at 1:52 PM, Alex Kocharin a...@kocharin.ru wrote:


 You can't run any ES6 script in a browser that don't support ES6, because
 they will throw syntax error at the first yield (unless you're using
 compiler like traceur, but it won't have a problem with getting .delete
 work either).

 If you use shims, that's fine, but you're not writing ES6, you're writing
 ES5+shims, and that's not ES6 because you can't use all the features it
 introduces. I believe ecmascript isn't versionless yet like html is, and
 that number means something.

 If you want to support IE6 without compiling, fine, you can write in
 ES3+shims using wm['delete'](object) syntax. I don't see it being an issue.


 18.12.2013, 00:59, Andrea Giammarchi andrea.giammar...@gmail.com:

 sorry what ?


 https://github.com/WebReflection/es6-collections#es6-harmony-collections-fast-polyfill
 https://code.google.com/p/es-lab/source/browse/trunk/src/ses/WeakMap.js
 https://github.com/Benvie/ES6-Harmony-Collections-Shim
 https://github.com/paulmillr/es6-shim
 https://gist.github.com/Gozala/1269991

 regards



 On Tue, Dec 17, 2013 at 11:38 AM, Alex Kocharin a...@kocharin.ru wrote:


 ES6 scripts will not work in IE8. Period. What's the point of making it
 work with a bit more ES6 scripts since all of them will never be supported
 anyway?

 I would only welcome if that badly written or outdated software gets
 exposed this way.


 17.12.2013, 22:59, Andrea Giammarchi andrea.giammar...@gmail.com:

 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 bruan...@gmail.com 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
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss

 ,

 ___
 es-discuss mailing list
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss


 ___
 es-discuss mailing list
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss


 ___
 es-discuss mailing list
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss


___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Alex Kocharin
 Well, you said that it works in IE8, and I don't care enough to test it, so said about IE6 because it is the same legacy kind of thing. Doesn't matter. Legacy and broken tools is not a valid reason to avoid perfectly good method name, especially considering the fact that it is a valid ES5 syntax everyone should be supporting for years now. "delete" can't stay a "not a reserved word, but kinda not recommended" forever you know, it doesn't make any sense. It should be named "delete" precisely because keyword was named delete, to make all these operators/functions look alike. Naming it "remove" just creates a confusion for no good reason.  18.12.2013, 02:17, "Andrea Giammarchi" andrea.giammar...@gmail.com:IE6 ? ... I don't understand your argument. We are talking about IE8 and polyfills that work already plus this does not solve the main problem which is about tools not always compatible with ES6 and/or future proof and shim aware. If tools were OK you wuld just write wm.delete(obj); and the tool would wrap that for you instead of throwing as these might do today. Regards On Tue, Dec 17, 2013 at 1:52 PM, Alex Kocharin a...@kocharin.ru wrote: You can't run any ES6 script in a browser that don't support ES6, because they will throw syntax error at the first yield (unless you're using compiler like traceur, but it won't have a problem with getting .delete work either). If you use shims, that's fine, but you're not writing ES6, you're writing ES5+shims, and that's not ES6 because you can't use all the features it introduces. I believe ecmascript isn't versionless yet like html is, and that number means something. If you want to support IE6 without compiling, fine, you can write in ES3+shims using wm['delete'](object) syntax. I don't see it being an issue.  18.12.2013, 00:59, "Andrea Giammarchi" andrea.giammar...@gmail.com:sorry what ? https://github.com/WebReflection/es6-collections#es6-harmony-collections-fast-polyfillhttps://code.google.com/p/es-lab/source/browse/trunk/src/ses/WeakMap.jshttps://github.com/Benvie/ES6-Harmony-Collections-Shimhttps://github.com/paulmillr/es6-shimhttps://gist.github.com/Gozala/1269991 regards On Tue, Dec 17, 2013 at 11:38 AM, Alex Kocharin a...@kocharin.ru wrote: ES6 scripts will not work in IE8. Period. What's the point of making it work with a bit more ES6 scripts since all of them will never be supported anyway? I would only welcome if that badly written or outdated software gets exposed this way.  17.12.2013, 22:59, "Andrea Giammarchi" andrea.giammar...@gmail.com: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 RegardsOn Tue, Dec 17, 2013 at 1:38 AM, David Bruant bruan...@gmail.com 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 es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss,___es-discuss mailing listes-discuss@mozilla.orghttps://mail.mozilla.org/listinfo/es-discuss___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss___ es-discuss mailing list 

Re: Could delete methods rename to remove?

2013-12-17 Thread Andrea Giammarchi
That's why my first hint was .del() as it is in Python and makes sense
since ever and it could have made perfect sense in JS too, also as alias
for .delete() while transitioning from ES3 legacy, ES5 quirk engines, and
ES.next

That being said, I was simply warning that tools might break so this is not
just a developer problem but a tooling problem too.

I would not change direction now about .delete() it's too late, shims are
out, and it makes sense for everything but IE8 (I don't care about IE8 on
mobile so I am selfishly OK with that :P)

So mine was a double warning plus some thoughts on possible different
directions the method name could have taken.

Cheers


On Tue, Dec 17, 2013 at 2:53 PM, Alex Kocharin a...@kocharin.ru wrote:


 Well, you said that it works in IE8, and I don't care enough to test it,
 so said about IE6 because it is the same legacy kind of thing. Doesn't
 matter.

 Legacy and broken tools is not a valid reason to avoid perfectly good
 method name, especially considering the fact that it is a valid ES5 syntax
 everyone should be supporting for years now.

 delete can't stay a not a reserved word, but kinda not recommended
 forever you know, it doesn't make any sense.

 It should be named delete precisely because keyword was named delete, to
 make all these operators/functions look alike. Naming it remove just
 creates a confusion for no good reason.


 18.12.2013, 02:17, Andrea Giammarchi andrea.giammar...@gmail.com:

 IE6 ? ... I don't understand your argument. We are talking about IE8 and
 polyfills that work already plus this does not solve the main problem which
 is about tools not always compatible with ES6 and/or future proof and shim
 aware.

 If tools were OK you wuld just write wm.delete(obj); and the tool would
 wrap that for you instead of throwing as these might do today.

 Regards


 On Tue, Dec 17, 2013 at 1:52 PM, Alex Kocharin a...@kocharin.ru wrote:


 You can't run any ES6 script in a browser that don't support ES6, because
 they will throw syntax error at the first yield (unless you're using
 compiler like traceur, but it won't have a problem with getting .delete
 work either).

 If you use shims, that's fine, but you're not writing ES6, you're writing
 ES5+shims, and that's not ES6 because you can't use all the features it
 introduces. I believe ecmascript isn't versionless yet like html is, and
 that number means something.

 If you want to support IE6 without compiling, fine, you can write in
 ES3+shims using wm['delete'](object) syntax. I don't see it being an issue.


 18.12.2013, 00:59, Andrea Giammarchi andrea.giammar...@gmail.com:

 sorry what ?


 https://github.com/WebReflection/es6-collections#es6-harmony-collections-fast-polyfill
 https://code.google.com/p/es-lab/source/browse/trunk/src/ses/WeakMap.js
 https://github.com/Benvie/ES6-Harmony-Collections-Shim
 https://github.com/paulmillr/es6-shim
 https://gist.github.com/Gozala/1269991

 regards



 On Tue, Dec 17, 2013 at 11:38 AM, Alex Kocharin a...@kocharin.ru wrote:


 ES6 scripts will not work in IE8. Period. What's the point of making it
 work with a bit more ES6 scripts since all of them will never be supported
 anyway?

 I would only welcome if that badly written or outdated software gets
 exposed this way.


 17.12.2013, 22:59, Andrea Giammarchi andrea.giammar...@gmail.com:

 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 bruan...@gmail.com 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 

Re: Could delete methods rename to remove?

2013-12-17 Thread Shijun He
You may not care about IE8, but many developers in the world MUST care
about it.

What I suggest is to help ES6 be faster to adopt, you know most team in
companies are conservative to edge tech, that's why we need es5-shim or
es6-shim projects.

It's too bad to write map['delete'], and you can't force all module authors
write like that. Tools are helpful, but as Andrea point out, many tools are
broken on reserved word up to now.

And I think remove is a better name because Java/C# collections all use
it.

In fact, I don't care about whether it name remove or del, but just dont
name it delete, such name just trouble the developers who want to migrate
to ES6 step by step.

On Wed, Dec 18, 2013 at 6:53 AM, Alex Kocharin a...@kocharin.ru wrote:


 Well, you said that it works in IE8, and I don't care enough to test it,
 so said about IE6 because it is the same legacy kind of thing. Doesn't
 matter.

 Legacy and broken tools is not a valid reason to avoid perfectly good
 method name, especially considering the fact that it is a valid ES5 syntax
 everyone should be supporting for years now.

 delete can't stay a not a reserved word, but kinda not recommended
 forever you know, it doesn't make any sense.

 It should be named delete precisely because keyword was named delete, to
 make all these operators/functions look alike. Naming it remove just
 creates a confusion for no good reason.


 18.12.2013, 02:17, Andrea Giammarchi andrea.giammar...@gmail.com:

 IE6 ? ... I don't understand your argument. We are talking about IE8 and
 polyfills that work already plus this does not solve the main problem which
 is about tools not always compatible with ES6 and/or future proof and shim
 aware.

 If tools were OK you wuld just write wm.delete(obj); and the tool would
 wrap that for you instead of throwing as these might do today.

 Regards


 On Tue, Dec 17, 2013 at 1:52 PM, Alex Kocharin a...@kocharin.ru wrote:


 You can't run any ES6 script in a browser that don't support ES6, because
 they will throw syntax error at the first yield (unless you're using
 compiler like traceur, but it won't have a problem with getting .delete
 work either).

 If you use shims, that's fine, but you're not writing ES6, you're writing
 ES5+shims, and that's not ES6 because you can't use all the features it
 introduces. I believe ecmascript isn't versionless yet like html is, and
 that number means something.

 If you want to support IE6 without compiling, fine, you can write in
 ES3+shims using wm['delete'](object) syntax. I don't see it being an issue.


 18.12.2013, 00:59, Andrea Giammarchi andrea.giammar...@gmail.com:

 sorry what ?


 https://github.com/WebReflection/es6-collections#es6-harmony-collections-fast-polyfill
 https://code.google.com/p/es-lab/source/browse/trunk/src/ses/WeakMap.js
 https://github.com/Benvie/ES6-Harmony-Collections-Shim
 https://github.com/paulmillr/es6-shim
 https://gist.github.com/Gozala/1269991

 regards



 On Tue, Dec 17, 2013 at 11:38 AM, Alex Kocharin a...@kocharin.ru wrote:


 ES6 scripts will not work in IE8. Period. What's the point of making it
 work with a bit more ES6 scripts since all of them will never be supported
 anyway?

 I would only welcome if that badly written or outdated software gets
 exposed this way.


 17.12.2013, 22:59, Andrea Giammarchi andrea.giammar...@gmail.com:

 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 bruan...@gmail.com 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 

Re: Could delete methods rename to remove?

2013-12-17 Thread John Lenz
ADVANCED mode requires property definitions for external properties. There
aren't ES6 definitions in the default externs for Map or other new features.
On Dec 17, 2013 10:59 AM, Andrea Giammarchi andrea.giammar...@gmail.com
wrote:

 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 bruan...@gmail.com 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
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss



 ___
 es-discuss mailing list
 es-discuss@mozilla.org
 https://mail.mozilla.org/listinfo/es-discuss


___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Alex Kocharin
  such name just trouble the developers who want to migrate to ES6 step by step How can you migrate to ES6 if you didn't even migrate to ES5 first?  18.12.2013, 07:17, "Shijun He" hax@gmail.com:You may not care about IE8, but many developers in the world MUST care about it.What I suggest is to help ES6 be faster to adopt, you know most team in companies are conservative to edge tech, that's why we need es5-shim or es6-shim projects.  It's too bad to write map['delete'], and you can't force all module authors write like that. Tools are helpful, but as Andrea point out, many tools are broken on reserved word up to now. And I think "remove" is a better name because Java/C# collections all use it.In fact, I don't care about whether it name remove or del, but just dont name it "delete", such name just trouble the developers who want to migrate to ES6 step by step.On Wed, Dec 18, 2013 at 6:53 AM, Alex Kocharin a...@kocharin.ru wrote: Well, you said that it works in IE8, and I don't care enough to test it, so said about IE6 because it is the same legacy kind of thing. Doesn't matter. Legacy and broken tools is not a valid reason to avoid perfectly good method name, especially considering the fact that it is a valid ES5 syntax everyone should be supporting for years now. "delete" can't stay a "not a reserved word, but kinda not recommended" forever you know, it doesn't make any sense. It should be named "delete" precisely because keyword was named delete, to make all these operators/functions look alike. Naming it "remove" just creates a confusion for no good reason.  18.12.2013, 02:17, "Andrea Giammarchi" andrea.giammar...@gmail.com:IE6 ? ... I don't understand your argument. We are talking about IE8 and polyfills that work already plus this does not solve the main problem which is about tools not always compatible with ES6 and/or future proof and shim aware. If tools were OK you wuld just write wm.delete(obj); and the tool would wrap that for you instead of throwing as these might do today. Regards On Tue, Dec 17, 2013 at 1:52 PM, Alex Kocharin a...@kocharin.ru wrote: You can't run any ES6 script in a browser that don't support ES6, because they will throw syntax error at the first yield (unless you're using compiler like traceur, but it won't have a problem with getting .delete work either). If you use shims, that's fine, but you're not writing ES6, you're writing ES5+shims, and that's not ES6 because you can't use all the features it introduces. I believe ecmascript isn't versionless yet like html is, and that number means something. If you want to support IE6 without compiling, fine, you can write in ES3+shims using wm['delete'](object) syntax. I don't see it being an issue.  18.12.2013, 00:59, "Andrea Giammarchi" andrea.giammar...@gmail.com:sorry what ? https://github.com/WebReflection/es6-collections#es6-harmony-collections-fast-polyfillhttps://code.google.com/p/es-lab/source/browse/trunk/src/ses/WeakMap.jshttps://github.com/Benvie/ES6-Harmony-Collections-Shimhttps://github.com/paulmillr/es6-shimhttps://gist.github.com/Gozala/1269991 regards On Tue, Dec 17, 2013 at 11:38 AM, Alex Kocharin a...@kocharin.ru wrote: ES6 scripts will not work in IE8. Period. What's the point of making it work with a bit more ES6 scripts since all of them will never be supported anyway? I would only welcome if that badly written or outdated software gets exposed this way.  17.12.2013, 22:59, "Andrea Giammarchi" andrea.giammar...@gmail.com: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 RegardsOn Tue, Dec 17, 2013 at 1:38 AM, David Bruant bruan...@gmail.com wrote:Le 17/12/2013 10:19, Shijun He a écrit :There are some methods using reserved word "delete", such as 

Re: Could delete methods rename to remove?

2013-12-17 Thread Shijun He
On Wed, Dec 18, 2013 at 11:30 AM, Rick Waldron waldron.r...@gmail.comwrote:


 Right, and map[delete](key) works fine. The future of the language
 itself should not be impaired by a browser that has an expiration date.



No, it does NOT work. Because you can't ask all module/library authors
write like that. And that means even such modules should be work in old
browsers with ES6-shim, they actually fail just because a simple name
problem.


And, ES6 and any future version of this language already impaired by legacy
browsers. For example, typeof null MUST be 'object'.





 The proposed collection APIs have been public for _years_ with a delete
 method. It's really not as bad as you're making seem, please be objective.


Yes they are here for years, but most JS devs never know about it. And I am
sure I can represent some of them.
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Shijun He
On Wed, Dec 18, 2013 at 11:28 AM, Alex Kocharin a...@kocharin.ru wrote:



 How can you migrate to ES6 if you didn't even migrate to ES5 first?



Even IE5 (pre-ES3) can use string.prototype.repeat with simple shim.

And with es6 shim, Map/Set SHOULD works on IE5, and all modules depend on
Map/Set (but not depend on complex features such as Proxy) also works.


So that's what I mean migration step by step. Some of your codes migrate to
ES6 API, but keep working on legacy browsers. It's very important for real
products. Or migration is totally impossible until 2023 if all pre-ES6
browsers disappear it that time.
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Rick Waldron
On Tue, Dec 17, 2013 at 10:45 PM, Shijun He hax@gmail.com wrote:




 On Wed, Dec 18, 2013 at 11:30 AM, Rick Waldron waldron.r...@gmail.comwrote:


 Right, and map[delete](key) works fine. The future of the language
 itself should not be impaired by a browser that has an expiration date.



 No, it does NOT work. Because you can't ask all module/library authors
 write like that.


Submit patches—libraries intended for use in IE8 should be made to support
that platform, it's that simple.


 And that means even such modules should be work in old browsers with
 ES6-shim, they actually fail just because a simple name problem.




 And, ES6 and any future version of this language already impaired by
 legacy browsers. For example, typeof null MUST be 'object'.


Wrong—that impairment has nothing to do with browsers, but with _existing_
code that makes incorrect assumptions (or none at all) about the return
value of typeof.

Rick
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss


Re: Could delete methods rename to remove?

2013-12-17 Thread Rick Waldron
On Tue, Dec 17, 2013 at 11:02 PM, Shijun He hax@gmail.com wrote:




 On Wed, Dec 18, 2013 at 11:28 AM, Alex Kocharin a...@kocharin.ru wrote:



 How can you migrate to ES6 if you didn't even migrate to ES5 first?



 Even IE5 (pre-ES3) can use string.prototype.repeat with simple shim.

 And with es6 shim, Map/Set SHOULD works on IE5, and all modules depend on
 Map/Set (but not depend on complex features such as Proxy) also works.


I doubt it.
https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L30-L34




 So that's what I mean migration step by step. Some of your codes migrate
 to ES6 API, but keep working on legacy browsers. It's very important for
 real products. Or migration is totally impossible until 2023 if all pre-ES6
 browsers disappear it that time.


I estimate the new version of ECMAScript will be either 9 or 10 in 2023 ;)

Rick
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss