Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editorial: take ToString and ToLength out of StringPad and make it infallible #3066

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

dewren99
Copy link
Contributor

Changed argument types and removed ToString and ToLength calls from StringPad as per #2634

For maxLength, I went with a non-negative integer instead of a Number.
I'm not sure if the new steps for String.prototype.padStart and String.prototype.padEnd are needed or not.

Please let me know if any further changes are needed, thanks!

spec.html Outdated Show resolved Hide resolved
spec.html Outdated Show resolved Hide resolved
Copy link
Member

@michaelficarra michaelficarra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good otherwise. You just need to apply those suggestions where appropriate.

@dewren99
Copy link
Contributor Author

@michaelficarra I've applied your suggestions and thank you for the detailed explanations, the changes make more sense to me now!

Also, the original issue suggested that it is editorial, but wouldn't these changes count as normative instead?

@michaelficarra
Copy link
Member

@dewren99 Normative changes are those that would change the behaviour of some program. This change shouldn't affect the behaviour of any program. All effects occur in the same order and under the same conditions.

spec.html Outdated Show resolved Hide resolved
@michaelficarra michaelficarra self-requested a review May 13, 2023 03:07
@michaelficarra michaelficarra added the editor call to be discussed in the next editor call label May 22, 2023
@michaelficarra
Copy link
Member

@dewren99 We discussed this in the editor call today. We would like to split out the (mostly) shared implementations of padStart and padEnd into a new AO. It would basically have the same signature as the old StringPad AO but its implementation would be what you currently have in padStart/padEnd. Then padStart/padEnd get reduced to just a call to this new AO, their only difference being passing ~start~/~end~ respectively. Does that make sense? Let me know if you have any questions. Once that's done, this should be good to go.

@michaelficarra michaelficarra removed the editor call to be discussed in the next editor call label May 24, 2023
@dewren99
Copy link
Contributor Author

dewren99 commented May 25, 2023

@michaelficarra sounds good! I think I understand the overall idea, but it might take a couple of tries for me to get it right.
I've split out the shared implementations of padStart and padEnd into a new AO, if you could check it that would be great!
Also, what should be the name of the new AO? As a placeholder, it is temporarily named StringPadStartEnd right now.

@michaelficarra
Copy link
Member

@dewren99 That looks good! Names are hard. I'd probably do something like StringPaddingBuiltinsImpl. Let's use that for now, and the other editors might come up with something better during their review.

@michaelficarra michaelficarra requested a review from a team May 25, 2023 14:56
@michaelficarra
Copy link
Member

@bakkot @syg This should be as we discussed at the last editor call now.

Copy link
Contributor

@syg syg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

spec.html Outdated
StringPad (
_S_: a String,
_maxLength_: a non-negative integer,
_fillString_: a String or *undefined*,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just be a String; the undefined case should be hoisted into StringPaddingBuiltinsImpl. Otherwise LGTM; I'll push up a commit with that change so it doesn't need to block.

@bakkot bakkot added the ready to merge Editors believe this PR needs no further reviews, and is ready to land. label Jun 15, 2023
…fallible (tc39#3066)

Co-authored-by: Deniz Eren Evrendilek <devrendilek@gmail.com>
Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
@ljharb ljharb merged commit 2e2cba5 into tc39:main Jun 15, 2023
zhangenming pushed a commit to zhangenming/ecma262 that referenced this pull request Dec 22, 2023
…fallible (tc39#3066)

Co-authored-by: Deniz Eren Evrendilek <devrendilek@gmail.com>
Co-authored-by: Kevin Gibbons <bakkot@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial change ready to merge Editors believe this PR needs no further reviews, and is ready to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants