Letting RegExp method return something iterable?

Brendan Eich brendan at mozilla.com
Thu Aug 29 19:04:28 PDT 2013

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.

Yes, ok -- I blew it by trying to emulate Perl 4. The jargon there was 
"list" vs "scalar" context, not "iterator".

> I'd love to be able to `send` a specific index to the generator, which 
> would be completely equivalent to `RegExp.prototype.exec` without the 
> lastIndex smell.

Why an index? Rarely have I seen anyone assign other than constant 0 to 


More information about the es-discuss mailing list