Letting RegExp method return something iterable?
brendan at mozilla.com
Thu Aug 29 01:13:29 PDT 2013
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 to the
awful Perl4-infused "mutable lastIndex state but only if global" kind.
The design decision to face is what to do when a global regexp is used.
Throw, or ignore its lastIndex?
More information about the es-discuss