-
Notifications
You must be signed in to change notification settings - Fork 18
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
Make arguments optional #152
Conversation
Also, take just a single parameter for `toString` rather than an options bag. We may discover a need for additional options, but for now, canonicalization is the only one.
<p>This method generates a String representation of the current Decimal128 object, in decimal format. Unlike Number’s <emu-xref href="#sec-number.prototype.tostring">toString</emu-xref>, this method always produces a decimal representation of the Decimal128 object and never produces an exponential representation. That functionality is provided by <emu-xref href="#sec-decimal.prototype.toexponential">toExponential</emu-xref>.</p> | ||
<p>It performs the following steps when called:</p> | ||
<emu-alg> | ||
1. Let _O_ be the *this* value. | ||
1. Perform ? RequireInternalSlot(_O_, [[Decimal128Data]]). | ||
1. Let _shouldCanonicalize_ be ? Get(_options_, *"canonicalize"*). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? Seems unrelated.
@@ -656,7 +655,7 @@ location: https://github.com/tc39/proposal-decimal/ | |||
</emu-clause> | |||
|
|||
<emu-clause id="sec-decimal.prototype.tofixed"> | |||
<h1>Decimal128.prototype.toFixed ( _numDigits_ [ , _shouldCanonicalize_ ] )</h1> | |||
<h1>Decimal128.prototype.toFixed ( [ _numDigits_ [ , _shouldCanonicalize_ ] ] )</h1> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the change is just the .length of the function? LGTM, IMO this change can be landed even though plenary is happening now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
I have some reservations about making toString's argument not be an options bag, but that seems like a discussion to have in stage 2.
This is handled by the work done in #158 |
Our intention for
toFixed
andtoPrecision
is to allow them to take no arguments, similar to how those methods work on Numbers. I wrestled with ecmarkup to get the notation right for that, trying various things, but nothing worked. As a consequence, the best I could do was to make the first argument mandatory and the second argument optional. But there is a way! And here it is. Thanks to @ben-allen for the solution.Since this is a normative change, please do not merge this PR until after the next TC39 plenary.