-
Notifications
You must be signed in to change notification settings - Fork 17
Advance to stage 3 #17
Comments
Would the reviewers have time to take a look before the upcoming TC39 meeting later this month? In addition to the existing spec text, I'd like to hear your input on this issue: #16 |
Existing spec text review:
Otherwise, consider me signed off. Re #16; my preference is to leave it as-is, consistent with |
Perhaps counter-intuitively, that would actually make
I propose we just leave |
@msaboff, @littledan, @gibson042, @zenparsing Could y'all take a look as well please? Keep in mind that #16 is still under discussion. |
The current spec text looks fine modulo the resolution to #16. Assuming that #16 is resolved allowing RegExp for searchValue and we don't auto-g Im signed off.. For #16, I don't want to disallow RegExp in replaceAll. That really seems counter intuitive. My preferred resolution to #16 is that we auto-g, but I am somewhat swayed by the precedent of matchAll not auto-g'ing. I personally don't think the copying of a RegExp, adding the g flag is a big deal. The "All" in a name (for both matchAll and replaceAll) connotes a repetitive application of an RegExp. |
The spec text looks correct for a So I think a rename is in order, which opens up the possibility of a signature with behavior that doesn't expect RegExp input (i.e., encouraging authors to use the new method for mass replacement of static strings but the preexisting |
Filed #22 as well for a bit of minor review. |
Stage 3 reviewers @littledan and @gibson042, could you please take another look now that #24 is merged? I'll present the proposal in its current form at the upcoming meeting, and (if possible) it would be great to have your reviews before then so we have the option to ask for Stage 3. Notably: |
@msaboff Same for you (although I had already checked your review bit earlier) -- PTAL given the recent changes. And @zenparsing, if you could take a look, that'd be great too :) |
Thanks for the review ping. I'm really happy with the semantics here, with #24 landed. LGTM for Stage 3. |
@zenparsing Gentle ping re: your editor review for Stage 3. |
@gibson042 Gentle ping re: your review for Stage 3. |
Here is my review of the latest version. For both replaceAll and matchAll, Step 2.b. should throw when flags is |
@msaboff What about |
I’d expect both if it’s going to throw, using RequireObjectCoercible |
I think the language in StringIndexOf should be more formal, as it was in String.prototype.indexOf. Suggestion:
We should also have a note about the implications for empty searchValue (i.e., that the result is -1 iff fromIndex is greater than the length of string, but otherwise is fromIndex—and in particular that there is a match after the last character of string). The rest looks good to me, but I think there's a gotcha (albeit one that is shared with String.prototype.replace) regarding sticky global regular expressions. Simplifying a great deal, RegExp.prototype[@@replace] sets Concretely, we get this potentially surprising behavior: "No Uppercase!".replaceAll(/[A-Z]/g, ""); // "o ppercase!"
"No Uppercase?".replaceAll(/[A-Z]/gy, ""); // "o Uppercase?"
"NO UPPERCASE!".replaceAll(/[A-Z]/gy, ""); // " UPPERCASE!" Further, both |
@gibson042 Re: sticky, I admit that's a gotcha I hadn't considered before! Nice find. I agree it's unclear if anything should be done about it, but I will present it to the committee so that any decision on this is intentional. For the |
Just wanted to point out, that bit came from |
The behavior for sticky+global replace is indeed weird, but IMHO orthogonal to this proposal. For (global) regexp patterns, |
|
The proposal advanced to stage 3 during the 2019-10-02 TC39 meeting. |
Criteria taken from the TC39 process document minus those from previous stages:
https://github.com/tc39/proposal-string-replaceall#specification
The text was updated successfully, but these errors were encountered: