Re: Non-extensibility of Typed Arrays

2013-08-29 Thread Filip Pizlo
Here's the part that gets me, though: what is the value of disallowing named properties on typed arrays? Who does this help? I don't quite buy that this helps users; most of the objects in your program are going to allow custom properties to be added at any point. That's kind of the whole

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Axel Rauschmayer
The fact that s.match(/re/g) returns the array of all matches (with captures) sucks some of the oxygen away from any /re/g.execAll(s) proposal. But String.prototype.match has perlish hair (e.g., those capture groups showing up in the result array). Really? AFAICT, only the complete

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Axel Rauschmayer
[...] I think this makes a good case for a lazy execAll -- with a much better name. Candidates: r.iterate(s), r.iterateOver(s), r.execIterator(s) (blech!). Suggest some! I think “exec” should be in the name, to indicate that the new method is a version of `exec()`. Ideas: –

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Brendan Eich
Axel Rauschmayer wrote: The fact that s.match(/re/g) returns the array of all matches (with captures) sucks some of the oxygen away from any /re/g.execAll(s) proposal. But String.prototype.match has perlish hair (e.g., those capture groups showing up in the result array). Really? AFAICT,

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Brendan Eich
Axel Rauschmayer wrote: – execIter() Not bad, I think better than execAll, which does not connote return of an iterator, but which does perversely suggest returning an array of all exec results. `execAll()` may not be that bad. It’s not pretty, but it’s fairly easy to guess what it does

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Axel Rauschmayer
I agree that execAll() is not a 100% winner, more like a clean-up of a quirky corner. But exec() in “multi” mode has a surprising amount of pitfalls: * /g flag must be set * lastIndex must be 0 * can’t inline the regex, because it is needed as a pseudo-iterator (more of an anti-pattern, anyway,

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Brendan Eich
Axel Rauschmayer wrote: * /g flag must be set * lastIndex must be 0 * can’t inline the regex, because it is needed as a pseudo-iterator (more of an anti-pattern, anyway, but still) * side effects via lastIndex may be a problem Anything we do of the execAll/execIter kind had better be immune

Re: `.toArray()` for all generators

2013-08-29 Thread Andreas Rossberg
On 28 August 2013 17:02, Forbes Lindesay for...@lindesay.co.uk wrote: It would be nice from a readability point of view if `iteratable.toArray()` could always be used as a substitute for `Array.from(iteratable)`. Is there a way that could be neatly achieved? It would also be nice if methods

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Dean Landolt
On Thu, Aug 29, 2013 at 4:13 AM, Brendan Eich bren...@mozilla.com wrote: Axel Rauschmayer wrote: * /g flag must be set * lastIndex must be 0 * can’t inline the regex, because it is needed as a pseudo-iterator (more of an anti-pattern, anyway, but still) * side effects via lastIndex may be

RE: `.toArray()` for all generators

2013-08-29 Thread Forbes Lindesay
This all seems fair enough. My concern is mostly that the `blob.method(fn)` syntax seems much easier to get your head around (as someone familiar to JavaScript) than the `[for (let x of iter) if (pred(x) transf(x)]`. I always used the traditional syntax for LINQ in C# as well (which gave you

Re: `.toArray()` for all generators

2013-08-29 Thread Andrea Giammarchi
plus any time you want you can `GenericPrototype.toArray = function(){return Array.from(this)};` ... no need to put in specs your C# flavor, somebody else Python flavor, Ruby, Java, or Haskell ... JS would look like the tower of babel ^_^ note: it kinda does already in specs V6 and early 7 On

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Oliver Hunt
On Aug 29, 2013, at 1:13 AM, Brendan Eich bren...@mozilla.com wrote: Axel Rauschmayer wrote: * /g flag must be set * lastIndex must be 0 * can’t inline the regex, because it is needed as a pseudo-iterator (more of an anti-pattern, anyway, but still) * side effects via lastIndex may be a

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Andrea Giammarchi
then you are probably looking for something like this? ```javascript String.prototype.matchAll = function (re) { for (var re = new RegExp( re.source, g + (re.ignoreCase ? i : ) + (re.multiline ? m : ) ), a = [], m; m = re.exec(this); a.push(m) );

Re: Array.prototype.slice web-compat issue?

2013-08-29 Thread Kevin Reid
On Wed, Aug 28, 2013 at 10:19 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: The problem is that in ES6 slice always returned a new Array instance using the Array of the realm associated with the invoked slice function. In ES6 slice returns an object that is determine based upon the actual

Clarify integer and safe integer resolution

2013-08-29 Thread Rick Waldron
At the last TC39 meeting we discussed the addition of the following items[0]: Number.MAX_SAFE_INTEGER = (2^53)-1 Number.isInteger - Infinity = false - NaN = false - value !== truncated value = false - -0 = true Number.isSafeInteger - -0 = true This resolution of record doesn't

typeof null

2013-08-29 Thread Axel Rauschmayer
Quick, possibly silly idea: What if `typeof null` returned `undefined`? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org

Re: typeof null

2013-08-29 Thread Brendan Eich
Nathan Wall wrote: Alex Rauschmayer wrote: Quick, possibly silly idea: What if `typeof null` returned `undefined`? By default or after you flip a switch? I have a better value objects draft coming, which addresses opt-in typeof reform (cross-realm!). In

Re: Array.prototype.slice web-compat issue?

2013-08-29 Thread Allen Wirfs-Brock
On Aug 29, 2013, at 10:51 AM, Kevin Reid wrote: On Wed, Aug 28, 2013 at 10:19 AM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: The problem is that in ES6 slice always returned a new Array instance using the Array of the realm associated with the invoked slice function. In ES6 slice

Re: Clarify integer and safe integer resolution

2013-08-29 Thread Mark S. Miller
I'm not sure the following is a bug, so discussing on es-discuss first before filing one. I agree that during the meeting we explicitly discussed MAX_SAFE_INTEGER but not MIN_SAFE_INTEGER, which is why I wrote presumably in my previous message. But I think it violates both consistency with the

Re: Array.prototype.slice web-compat issue?

2013-08-29 Thread Kevin Reid
On Thu, Aug 29, 2013 at 12:56 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: On Aug 29, 2013, at 10:51 AM, Kevin Reid wrote: This is a hazardous change for SES-style security. For example, I've just taken a quick look at our (Caja) codebase and found a place where

Re: Array.prototype.slice web-compat issue?

2013-08-29 Thread Allen Wirfs-Brock
On Aug 29, 2013, at 1:39 PM, Kevin Reid wrote: On Thu, Aug 29, 2013 at 12:56 PM, Allen Wirfs-Brock al...@wirfs-brock.com wrote: On Aug 29, 2013, at 10:51 AM, Kevin Reid wrote: This is a hazardous change for SES-style security. For example, I've just taken a quick look at our (Caja)

Re: Array.prototype.slice web-compat issue?

2013-08-29 Thread Kevin Reid
On Thu, Aug 29, 2013 at 2:21 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote: Of the two cases I refer to, one is a function (the trademarking stamp()) which takes a list of objects as a parameter and needs to ensure that successive stages of processing operate on exactly the same set of

Re: Array.prototype.slice web-compat issue?

2013-08-29 Thread Brendan Eich
Kevin Reid wrote: (I admit I favor composition/delegation over inheritance, for public interfaces, and therefore dislike the notion of working with subclasses of concrete built-ins. +∞ But one could also consider, for example, the reasons why java.lang.String is final.) One could also

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Brendan Eich
Dean Landolt wrote: I'd hate to see it throw. Ignoring lastIndex seems friendlier, especially if it were called `execAll`. It probably shouldn't be called `execIter` considering `exec` is already an iterator (even if a bit crazy). 'exec' is not an iterator in any well-defined ES6 sense.

Re: Letting RegExp method return something iterable?

2013-08-29 Thread Brendan Eich
Oliver Hunt wrote: I would favor ignoring lastIndex rather than throwing, but to be sure can you clarify what you mean by global regexp? One created with the 'g' flag, either literally (/re/g) or via the constructor (new RegExp(src, 'g')). If we're talking /.../g, then my feeling is that