Re: Idea for ECMAScript 7: Number.compare(a, b)

2014-06-06 Thread Mathias Bynens
On 6 Jun 2014, at 01:15, Axel Rauschmayer a...@rauschma.de wrote: It’d be nice to have a built-in way for comparing numbers, e.g. when sorting arrays. ```js // Compact ECMAScript 6 solution // Risk: number overflow [1, 5, 3, 12, 2].sort((a,b) = a-b) // Proposed new function: [1, 5,

Re: Idea for ECMAScript 7: Number.compare(a, b)

2014-06-06 Thread Hemanth H.M
Something like: ```js Number.compare = (n1, n2) - (n1 - n2) / Math.abs(n1 - n2) || 0; ``` On Fri, Jun 6, 2014 at 12:40 PM, Mathias Bynens mathi...@opera.com wrote: On 6 Jun 2014, at 01:15, Axel Rauschmayer a...@rauschma.de wrote: It’d be nice to have a built-in way for comparing numbers,

Re: Idea for ECMAScript 7: Number.compare(a, b)

2014-06-06 Thread Hemanth H.M
My bad! Miss read it. ^That still sorts in ascending order only. On Fri, Jun 6, 2014 at 5:08 PM, Hemanth H.M hemanth...@gmail.com wrote: Something like: ```js Number.compare = (n1, n2) - (n1 - n2) / Math.abs(n1 - n2) || 0; ``` On Fri, Jun 6, 2014 at 12:40 PM, Mathias Bynens

A reprieve for ES6 comprehensions

2014-06-06 Thread Andy Wingo
Hi, dherman has argued that comprehensions should be removed from the ES6 draft: https://speakerdeck.com/dherman/a-better-future-for-comprehensions The argument is that the existing comprehension mechanism is incompatible with future extensions, notably parallelism. I am not sure I buy this

Re: My ECMAScript 7 wishlist

2014-06-06 Thread David Bruant
Le 06/06/2014 01:08, Rick Waldron a écrit : On Thu, Jun 5, 2014 at 6:42 PM, Nicholas C. Zakas standa...@nczconsulting.com mailto:standa...@nczconsulting.com wrote: * `Object.deepPreventExtensions()`, `Object.deepSeal()`, `Object.deepFreeze()` - deep versions of

Re: A reprieve for ES6 comprehensions

2014-06-06 Thread Andy Wingo
Hi, A final point while I am thinking about it: On Fri 06 Jun 2014 13:57, Andy Wingo wi...@igalia.com writes: 1: Essential differences == Array comprehensions are eager. Generator comprehensions are lazy. This difference shows up here, for example: Q.async(function*(){ return [for

Publication date of ES7?

2014-06-06 Thread Axel Rauschmayer
Sorry, I tried finding it (e.g. on [1] and the mailing list), but couldn’t: when is the currently planned publication date of ECMAScript 7? Thanks! Axel [1] https://github.com/tc39/ecma262 -- Dr. Axel Rauschmayer a...@rauschma.de rauschma.de ___

Re: My ECMAScript 7 wishlist

2014-06-06 Thread Mark S. Miller
On Fri, Jun 6, 2014 at 5:44 AM, David Bruant bruan...@gmail.com wrote: Le 06/06/2014 01:08, Rick Waldron a écrit : On Thu, Jun 5, 2014 at 6:42 PM, Nicholas C. Zakas standa...@nczconsulting.com wrote: * `Object.deepPreventExtensions()`, `Object.deepSeal()`, `Object.deepFreeze()` - deep

Re: A reprieve for ES6 comprehensions

2014-06-06 Thread C. Scott Ananian
On Fri, Jun 6, 2014 at 7:57 AM, Andy Wingo wi...@igalia.com wrote: Comprehensions match ES6 very well as it is, without considering the possible addition of parallelism. They even match up well if we add the other dimension of asynchronous comprehensions -- i.e. [for x of await y z], (for x

Re: My ECMAScript 7 wishlist

2014-06-06 Thread David Bruant
Le 06/06/2014 15:57, Mark S. Miller a écrit : By contrast, a Map's state is more like the private instance variable state of a closure or a post-ES6 class. The capabilities to arbitrarily modify Maps (set/delete on all keys, with any values) will be expected by any ES6-compliant code to be

Re: Idea for ECMAScript 7: Number.compare(a, b)

2014-06-06 Thread Claude Pache
Le 6 juin 2014 à 01:18, C. Scott Ananian ecmascr...@cscott.net a écrit : On Thu, Jun 5, 2014 at 7:15 PM, Axel Rauschmayer a...@rauschma.de wrote: ```js // Compact ECMAScript 6 solution // Risk: number overflow [1, 5, 3, 12, 2].sort((a,b) = a-b) ``` Is this really an issue for IEEE

Re: My ECMAScript 7 wishlist

2014-06-06 Thread Mark S. Miller
On Fri, Jun 6, 2014 at 7:37 AM, David Bruant bruan...@gmail.com wrote: Le 06/06/2014 15:57, Mark S. Miller a écrit : By contrast, a Map's state is more like the private instance variable state of a closure or a post-ES6 class. The capabilities to arbitrarily modify Maps (set/delete on all

Re: My ECMAScript 7 wishlist

2014-06-06 Thread Frankie Bagnardi
Couldn't preventUndeclaredGet() be implemented with proxies? It actually sounds like an extremely useful feature for development builds of libraries and applications. Typos are very very common, and often difficult to look over while debugging. On the other hand, it would break a lot of

Re: My ECMAScript 7 wishlist

2014-06-06 Thread David Bruant
Le 06/06/2014 17:47, Frankie Bagnardi a écrit : Couldn't preventUndeclaredGet() be implemented with proxies? Yes it can. Doing it left as an exercise to the reader... Wait... Don't bother, Nicholas did it :-) http://www.nczonline.net/blog/2014/04/22/creating-defensive-objects-with-es6-proxies/

Re: My ECMAScript 7 wishlist

2014-06-06 Thread Nicholas C. Zakas
On 6/5/2014 4:08 PM, Rick Waldron wrote: * `Object.deepPreventExtensions()`, `Object.deepSeal()`, `Object.deepFreeze()` - deep versions of `Object.preventExtensions()`, et al. Does deep mean that a Map instance's [[MapData]] is frozen if deepFreeze is called on a ? eg. what

Re: A bit confused by B.3.2 - Web Legacy Compatibility for Block-Level Function Declarations

2014-06-06 Thread John Lenz
Or a link to the discussion that led to the content of this section? On Thu, Jun 5, 2014 at 9:51 AM, John Lenz concavel...@gmail.com wrote: Is there any place that has some concrete examples of the different cases we are trying support with this section (and whether the function is block

Re: My ECMAScript 7 wishlist

2014-06-06 Thread Nicholas C. Zakas
On 6/6/2014 8:38 AM, Mark S. Miller wrote: But the concern Nicholas raises doesn't seem to have this property. Reading a property that doesn't exist doesn't carry a security risk, does it? Object.preventUndeclaredGet doesn't really protect against anything like ES5 methods did.

Re: My ECMAScript 7 wishlist

2014-06-06 Thread David Bruant
Le 06/06/2014 18:16, Nicholas C. Zakas a écrit : On 6/6/2014 8:38 AM, Mark S. Miller wrote: But the concern Nicholas raises doesn't seem to have this property. Reading a property that doesn't exist doesn't carry a security risk, does it? Object.preventUndeclaredGet doesn't

Re: A bit confused by B.3.2 - Web Legacy Compatibility for Block-Level Function Declarations

2014-06-06 Thread André Bargull
Or a link to the discussion that led to the content of this section? There have been multiple discussions on this topic, on both es-discuss and during TC39 meetings, so it's hard to point to a single discussion. For example:

Re: My ECMAScript 7 wishlist

2014-06-06 Thread Andrea Giammarchi
On Fri, Jun 6, 2014 at 8:38 AM, Mark S. Miller erig...@google.com wrote: The most common way to do such feature testing is to get the property and see if it is falsy. this is why for years many of us have been advocating the usage of `'name' in object` instead of passing through getters ...

Re: My ECMAScript 7 wishlist

2014-06-06 Thread Brendan Eich
Nicholas C. Zakas wrote: It can be done with Proxy, but that kind of sucks because I always need to go through the extra step of creating the Proxy for each object and passing around the Proxy instead. To me, this is similar to setting a property to be readonly in strict mode, except its

Re: My ECMAScript 7 wishlist

2014-06-06 Thread Brendan Eich
Just FTR, I'll put a ratioanlized ES7 proposal on the agenda for the July TC39 meeting, as per https://twitter.com/BrendanEich/status/475067783282057216 Thanks to Nicholas for the suggestion! /be Brendan Eich wrote: Nicholas C. Zakas wrote: It can be done with Proxy, but that kind of sucks

Re: My ECMAScript 7 wishlist

2014-06-06 Thread Andrea Giammarchi
that `has:()=true` breaks with features detections that are meant to be less obtrusive than getters ... i.e. `'geolocation' in navigator` or `'innerHTML' in genericNode` and all others that are not supposed to pass through a potentially expensive getter to retrieve a feature detection purpose

Re: A bit confused by B.3.2 - Web Legacy Compatibility for Block-Level Function Declarations

2014-06-06 Thread John Lenz
Great thanks for the links. I missed or had forgotten the Jan 2014 summary. The summary for that discussion is pretty clear that the functions have two bindings (a block local one and a function scope one, if it can) and I assume that is what the spec is trying to specify. Specifically, within

Re: A bit confused by B.3.2 - Web Legacy Compatibility for Block-Level Function Declarations

2014-06-06 Thread Allen Wirfs-Brock
On Jun 6, 2014, at 6:30 PM, John Lenz concavel...@gmail.com wrote: Great thanks for the links. I missed or had forgotten the Jan 2014 summary. The summary for that discussion is pretty clear that the functions have two bindings (a block local one and a function scope one, if it can) and