Ron Buckton wrote:
The advantage of a lazy execAll, is the ability to break out of the for..of loop without the need to continue to traverse the input string looking for matches. This is the same advantage that the `while(m = re.exec())` has going for it. You can always be greedy by using Array.from or an array comprehension if execAll is lazy, but you are back to using a while loop if execAll is greedy and you want lazy matching, which limits its usefulness in some scenarios.

Good point -- on top of the quasi-redundancy of an eager execAll viz. String.prototype.match, 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!

/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to