Re: Proposal: Syntax sugar for single exit and early exit functions.

2014-11-17 Thread Alex Kocharin
I don't think we need to add any syntax sugar for the examples below.Answering with examples inline:17.11.2014, 03:07, “Biju” bijumaill...@gmail.com:  I wish, I could write elegant two of the code pattern I use frequently.Patten 1.HTML button click event handler should always return false (ie,

Re: Proposal: Syntax sugar for single exit and early exit functions.

2014-11-17 Thread Andreas Rossberg
On 17 November 2014 17:29, Alex Kocharin a...@kocharin.ru wrote: 17.11.2014, 03:07, “Biju” bijumaill...@gmail.com: I wish, I could write elegant two of the code pattern I use frequently. [...] Patten 2. I do like to code functions with early exit, like function someValidationProcess(){

Re: Proposal: Syntax sugar for single exit and early exit functions.

2014-11-17 Thread Jeremy Martin
`validate: { ... }` Is that an ES7 feature? I don't recognize it from ES6, and can't seem to find a relevant proposal with that syntax... On Mon, Nov 17, 2014 at 11:51 AM, Andreas Rossberg rossb...@google.com wrote: On 17 November 2014 17:29, Alex Kocharin a...@kocharin.ru wrote: 17.11.2014,

Re: Proposal: Syntax sugar for single exit and early exit functions.

2014-11-17 Thread Jeremy Martin
OH JEEZ. Please ignore previous email. On Mon, Nov 17, 2014 at 12:00 PM, Jeremy Martin jmar...@gmail.com wrote: `validate: { ... }` Is that an ES7 feature? I don't recognize it from ES6, and can't seem to find a relevant proposal with that syntax... On Mon, Nov 17, 2014 at 11:51 AM,

Re: Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

2014-11-17 Thread Allen Wirfs-Brock
On Nov 16, 2014, at 11:08 PM, Tom Van Cutsem wrote: 2014-11-17 3:34 GMT+01:00 Frankie Bagnardi f.bagna...@gmail.com: Consider when Array.isArray would be used. In my experience, checks to see if something is an array are used for: - deciding how to iterate it (for(;;) vs for..in, for

Re: Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

2014-11-17 Thread Brendan Eich
Allen Wirfs-Brock wrote: ```js Array[Symbol.isArray]] = true; //note, this is a constructor property, not an Array.prototype property. Minomer, then -- how about Symbol.isArrayClass? we also change Array.prototype.concat to do the above Array.isArray test instead of using

Re: Map: filter/map and more

2014-11-17 Thread Dmitry Soshnikov
Is this something what is ready for discussion on a meeting (in particular, tomorrow's meeting)? Regardless, whether the `map` and `set` will be directly on the `Map.prototype` or on some generic `%CollectionPrototype%`, the user-level API will stay the same, right? And will be used as: ```

Re: Map: filter/map and more

2014-11-17 Thread Brendan Eich
Dmitry Soshnikov wrote: Is this something what is ready for discussion on a meeting (in particular, tomorrow's meeting)? You put something on the agenda, cool. https://github.com/tc39/agendas/blob/master/2014/11.md /be ___ es-discuss mailing list

Re: Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

2014-11-17 Thread Allen Wirfs-Brock
On Nov 17, 2014, at 11:06 AM, Brendan Eich wrote: Allen Wirfs-Brock wrote: ```js Array[Symbol.isArray]] = true; //note, this is a constructor property, not an Array.prototype property. Minomer, then -- how about Symbol.isArrayClass? perhaps, I have a negative reaction to including the

Re: Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

2014-11-17 Thread Allen Wirfs-Brock
On Nov 17, 2014, at 2:30 PM, Allen Wirfs-Brock wrote: On Nov 17, 2014, at 11:06 AM, Brendan Eich wrote: Allen Wirfs-Brock wrote: ```js Array[Symbol.isArray]] = true; //note, this is a constructor property, not an Array.prototype property. Minomer, then -- how about

Re: Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

2014-11-17 Thread Brendan Eich
Allen Wirfs-Brock wrote: if (isProxy(obj)) return isArray(getProxyTarget(obj)); //Array.isArray(new Proxy(Object.create(Array.prototype), {})) //I'm not sure that the above line is really a compat. issue. I'd prefer to leave it out. Please do -- it contradicts the righteous

Re: Proposal: Syntax sugar for single exit and early exit functions.

2014-11-17 Thread Biju
On 17 November 2014 11:29, Alex Kocharin a...@kocharin.ru wrote: If you do the same stuff after each function, some functional programming could help: function someValidationProcess() { ;[doStuff, doAnotherStuff, doYetAnotherStuff, doMoreStuff] .forEach(function(fn) { fn()

Re: Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

2014-11-17 Thread Tom Van Cutsem
2014-11-17 18:30 GMT+01:00 Allen Wirfs-Brock al...@wirfs-brock.com: But probing through the proxy as has been proposed is a terrible violation of the MOP API boundary and isn't generalizable to other built-ins that are dependent upon internal state. While a null handler proxy on a direct

Re: Proposal: Syntax sugar for single exit and early exit functions.

2014-11-17 Thread Garrett Smith
On 11/16/14, Biju bijumaill...@gmail.com wrote: [...] Proposal: I wish there was some syntax sugar like function someClickHandler(){ doStuff(); doAnotherStuff(); doYetAnotherStuff(); } finally { return false; } function rf() { try { throw-an-error; } finally {