Functions in ES6

2013-03-25 Thread Axel Rauschmayer
A rough guide for migrating functions from ES5 to ES6 would be: 1. Function declarations -- function declarations 2. Function expressions -- arrow functions 3. IIFEs -- blocks 4. Functions in object literals -- concise method syntax 5. Constructors -- classes 6. New: generator functions These

RE: What's the correct behavior for \8 and \9

2013-03-25 Thread BelleveInvis
But, according to spec, \8 and \9 SHOULD cause a syntax error. Because in string literals, EscapeSequence - CharacterEscapeSequence and CharacterEscapeSequence - SingleEscapeCharacterCharacterEscapeSequence - NonEscapeCharacter The NonEscapeCharacter is defined as SourceCharacter minus

Two different use cases for privacy?

2013-03-25 Thread Axel Rauschmayer
It seems to me that there are two different use cases for privacy: Use case 1: Hide some properties from the outside (when listing properties or getting expansion help from an IDE). Many people use a naming convention here (e.g. a prefixed underscore). This hiding does not have to be completely

Re: Re: Two different use cases for privacy?

2013-03-25 Thread André Bargull
The function for use case #1 seems to be Object.getOwnPropertyKeys() [15.2.3.15]: js Object.keys(Array) [] js Object.getOwnPropertyNames(Array) [length,name,prototype,isArray,of,from,caller,arguments] js [for (x of Object.getOwnPropertyKeys(Array)) x]

Re: Functions in ES6

2013-03-25 Thread Claude Pache
Le 25 mars 2013 à 08:28, Axel Rauschmayer a...@rauschma.de a écrit : 2. Function expressions -- arrow functions No, it depends. Roughly, I would replace function expressions by arrow functions when I want to use the 'this' binding of the enclosing scope (or don't use the 'this' binding), and

Weak event listener

2013-03-25 Thread Marius Gundersen
I tried posting this before, but it seems to have gotten lost on the internet. One thing which is impossible to make in JavaScript today is a weakly referenced event listener system. In such a system an event listener is not strongly referenced by the event system, so events are only dispatched

Re: Weak event listener

2013-03-25 Thread Kevin Gadd
Most use cases I've personally seen for weak events would be satisfied by a WeakMap of weak event target - event handler. Having the event handler itself be weak instead of the event target seems strange to me; it introduces a bunch of nondeterministic behavior that isn't desirable - sometimes

Re: Functions in ES6

2013-03-25 Thread Rick Waldron
On Mon, Mar 25, 2013 at 3:28 AM, Axel Rauschmayer a...@rauschma.de wrote: A rough guide for migrating functions from ES5 to ES6 would be: 1. Function declarations -- function declarations 2. Function expressions -- arrow functions Claude nailed this one 3. IIFEs -- blocks or Modules

Modules feedback from March 2013 meeting

2013-03-25 Thread James Burke
I expect the module champions to be busy, so I am not expecting a response. This is just some feedback to consider or discard at their discretion. I'll wait for the next public update on modules to see where things end up. In general, sounds promising. I'm going off the meeting notes from here

Re: Functions in ES6

2013-03-25 Thread Allen Wirfs-Brock
On Mar 25, 2013, at 1:57 AM, Claude Pache wrote: Le 25 mars 2013 à 08:28, Axel Rauschmayer a...@rauschma.de a écrit : 2. Function expressions -- arrow functions No, it depends. Roughly, I would replace function expressions by arrow functions when I want to use the 'this' binding of

Re: Functions in ES6

2013-03-25 Thread Axel Rauschmayer
Possibly worth mentioning: If you use `super` then Object.defineProperty() does not work, only Object.assign() and Object.mixin() update [[HomeObject]]. AFAIK, we don’t have Object.defineMethod() yet (maybe ever). On Mar 25, 2013, at 19:09 , Allen Wirfs-Brock al...@wirfs-brock.com wrote: On

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Kenneth Russell
On Fri, Mar 22, 2013 at 7:47 PM, Brendan Eich bren...@mozilla.com wrote: Kenneth Russell wrote: I hope that the ES6 integration of typed arrays will not require normalization of NaNs on write, even if other specification changes need to be made to avoid requiring it. What other

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Kenneth Russell
On Fri, Mar 22, 2013 at 10:34 PM, David Herman dher...@mozilla.com wrote: On Mar 22, 2013, at 7:47 PM, Brendan Eich bren...@mozilla.com wrote: Kenneth Russell wrote: I hope that the ES6 integration of typed arrays will not require normalization of NaNs on write, even if other specification

Re: Modules feedback from March 2013 meeting

2013-03-25 Thread Sam Tobin-Hochstadt
On Mon, Mar 25, 2013 at 1:31 PM, James Burke jrbu...@gmail.com wrote: I expect the module champions to be busy, so I am not expecting a response. This is just some feedback to consider or discard at their discretion. I'll wait for the next public update on modules to see where things end up.

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Brendan Eich
Kenneth Russell wrote: For interop, JS requires cross-browser (VM) NaN canonicalization to avoid observably different results on different browsers. As long as NaN values loaded from Float32Array and Float64Array obey ES6's semantics, such as returning true from isNaN(), then it should not

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Kenneth Russell
On Mon, Mar 25, 2013 at 2:40 PM, Brendan Eich bren...@mozilla.com wrote: Kenneth Russell wrote: For interop, JS requires cross-browser (VM) NaN canonicalization to avoid observably different results on different browsers. As long as NaN values loaded from Float32Array and Float64Array

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Allen Wirfs-Brock
On Mar 25, 2013, at 2:40 PM, Brendan Eich wrote: Kenneth Russell wrote: For interop, JS requires cross-browser (VM) NaN canonicalization to avoid observably different results on different browsers. As long as NaN values loaded from Float32Array and Float64Array obey ES6's semantics,

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Brendan Eich
Allen Wirfs-Brock wrote: BTW, isn't cannonicalization of endian-ness for both integers and floats a bigger interop issue than NaN cannonicalization? I know this was discussed in the past, but it doesn't seem to be covered in the latest Khronos spec. Was there ever a resolution as to whether

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Allen Wirfs-Brock
On Mar 25, 2013, at 4:05 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: BTW, isn't cannonicalization of endian-ness for both integers and floats a bigger interop issue than NaN cannonicalization? I know this was discussed in the past, but it doesn't seem to be covered in the latest

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Brendan Eich
Allen Wirfs-Brock wrote: On Mar 25, 2013, at 4:05 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: BTW, isn't cannonicalization of endian-ness for both integers and floats a bigger interop issue than NaN cannonicalization? I know this was discussed in the past, but it doesn't seem to be

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Kenneth Russell
On Mon, Mar 25, 2013 at 4:23 PM, Brendan Eich bren...@mozilla.com wrote: Allen Wirfs-Brock wrote: On Mar 25, 2013, at 4:05 PM, Brendan Eich wrote: Allen Wirfs-Brock wrote: BTW, isn't cannonicalization of endian-ness for both integers and floats a bigger interop issue than NaN

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Brendan Eich
Right, thanks for the reminder. It all comes back now, including the how to write correct ending-independent typed array code bit. /be On Mar 25, 2013, at 4:33 PM, Kenneth Russell k...@google.com wrote: On Mon, Mar 25, 2013 at 4:23 PM, Brendan Eich bren...@mozilla.com wrote: Allen

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Allen Wirfs-Brock
On Mar 25, 2013, at 6:00 PM, Brendan Eich wrote: Right, thanks for the reminder. It all comes back now, including the how to write correct ending-independent typed array code bit. Ok, so looping back to my earlier observation. It sounds like endian-ness can be observed by writing into an

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Bjoern Hoehrmann
* Kenneth Russell wrote: No. The typed array views (everything except DataView) have used the host machine's endianness from day one by design -- although the typed array spec does not state this explicitly. If desired, text can be added to the specification to this effect. That seems to be

Re: Observability of NaN distinctions — is this a concern?

2013-03-25 Thread Oliver Hunt
On Mar 26, 2013, at 2:35 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Mar 25, 2013, at 6:00 PM, Brendan Eich wrote: Right, thanks for the reminder. It all comes back now, including the how to write correct ending-independent typed array code bit. Ok, so looping back to my

Re: Weak event listener

2013-03-25 Thread Erik Arvidsson
WeakMap would not work in this specific case since a WeakMap cannot be iteratered. WeakRefs are needed to do data binding and pub sub systems like these. WeakRefs are very likely to be part of ES7. We haven't really talked much about them formally but informally TC39 members seems to agree.

Re: Weak event listener

2013-03-25 Thread Peter Michaux
On Mon, Mar 25, 2013 at 2:55 AM, Marius Gundersen gunder...@gmail.com wrote: One thing which is impossible to make in JavaScript today is a weakly referenced event listener system. In such a system an event listener is not strongly referenced by the event system, so events are only dispatched

Re: Weak event listener

2013-03-25 Thread Benoit Marchant
Very true, I'm wondering if based on usage today it could make sense to have this as default behavior on current API? Benoit On Mar 25, 2013, at 19:51, Peter Michaux petermich...@gmail.com wrote: On Mon, Mar 25, 2013 at 2:55 AM, Marius Gundersen gunder...@gmail.com wrote: One thing which

Re: Modules feedback from March 2013 meeting

2013-03-25 Thread James Burke
Hi Sam, I really was not expecting a reply, as it was a lot of feedback. Just wanted to get some things in the to be considered at some point/use case queue. Some clarifications, but I do not think it is worth continuing discussion here given the breadth of the feedback and the stage of the spec