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

Per May 2016 TC39 consensus, String#{padStart,padEnd} is now stage 4! #581

Merged
merged 1 commit into from
Jun 1, 2016

Conversation

ljharb
Copy link
Member

@ljharb ljharb commented May 25, 2016

1. Let _O_ be ? RequireObjectCoercible(*this* value).
1. Let _S_ be ? ToString(_O_).
1. Let _intMaxLength_ be ? ToLength(_maxLength_).
1. Let _stringLength_ be the number of elements in S.
Copy link
Member

Choose a reason for hiding this comment

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

S -> S

Copy link
Member Author

Choose a reason for hiding this comment

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

whoops, thanks!

@ljharb ljharb force-pushed the string-padstart branch from 586e037 to 8148b68 Compare May 25, 2016 12:37
1. Let _intMaxLength_ be ? ToLength(_maxLength_).
1. Let _stringLength_ be the number of elements in S.
1. If _intMaxLength_ is not greater than _stringLength_, return _S_.
1. If _fillString_ is *undefined*, let _filler_ be a string consisting solely of the code unit U+0020 (SPACE).
Copy link
Member

Choose a reason for hiding this comment

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

The draft consistently uses U+ notation with code point or character, not code unit. Also, String?

Copy link
Member Author

Choose a reason for hiding this comment

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

I discussed this with @bterlson in stage 3, and this was the preferred mechanism.

The capitalization seems to have been made consistent since I initially wrote the text - will update!

Copy link
Member Author

Choose a reason for hiding this comment

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

oh actually, it's lowercased in a number of places - I think we should make them all consistent in a separate commit/PR.

@annevk
Copy link
Member

annevk commented May 25, 2016

To be clear, I don't think putting code unit and U+ together makes sense. They are a little different. The standard seems to typically use "character"...

@ljharb
Copy link
Member Author

ljharb commented May 25, 2016

@annevk hmm - it seems that all the previous examples have been converted to use "0x" notation - grep the spec for "string consisting". I'll happily convert this from "U+0020" to "0x0020" though.

@ljharb ljharb force-pushed the string-padstart branch from 8148b68 to 27832af Compare May 25, 2016 12:43
@annevk
Copy link
Member

annevk commented May 25, 2016

You still have "a string" and "a new String value".

@ljharb
Copy link
Member Author

ljharb commented May 25, 2016

Both capitalizations are identically equivalent and appear numerous times throughout the spec.

@annevk
Copy link
Member

annevk commented May 25, 2016

Wouldn't you want to use a single style inside one algorithm though? Anyway, up to you all...

@ljharb ljharb force-pushed the string-padstart branch from 27832af to 8b72d16 Compare May 25, 2016 13:25
@ljharb
Copy link
Member Author

ljharb commented May 25, 2016

Fair enough :-) updated.

<emu-note>The first argument _maxLength_ will be clamped such that it can be no smaller than the length of the *this* value.</emu-note>
<emu-note>The optional second argument _fillString_ defaults to *" "* (a String consisting of 0x0020 SPACE).</emu-note>
</emu-clause>

<!-- es6num="21.1.4" -->
<emu-clause id="sec-properties-of-string-instances">
Copy link
Contributor

Choose a reason for hiding this comment

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

The logical placement of the new clauses seems wrong. In order to respect both section hierarchy and alphabetical order:

  • they should be placed between subsections String.prototype.normalize and String.prototype.repeat, inside (and not after) section "Properties of the String Prototype Object";
  • String.prototype.padEnd should be placed before String.prototype.padStart.

Copy link
Member Author

Choose a reason for hiding this comment

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

I intended to place them at the end of the section "Properties of the String Prototype Object" - I didn't realize they were supposed to be alphabetized. I'll fix both.

@ljharb ljharb force-pushed the string-padstart branch from 8b72d16 to c31a686 Compare May 25, 2016 16:35
@bterlson bterlson merged commit fba0bff into tc39:master Jun 1, 2016
@ljharb ljharb deleted the string-padstart branch June 1, 2016 21:11
zloirock added a commit to compat-table/compat-table that referenced this pull request Jun 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants