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

String(Intl)MV should be defined in ECMA-262 #124

Open
gibson042 opened this issue Jan 11, 2023 · 2 comments
Open

String(Intl)MV should be defined in ECMA-262 #124

gibson042 opened this issue Jan 11, 2023 · 2 comments
Labels
editorial Issue should be resolved in the spec future Out of scope for the current proposal

Comments

@gibson042
Copy link
Contributor

Rather than effectively redefining ECMA-262 StringNumericValue minus RoundMVResult, can we define the syntax-directed operation proposed as "StringIntlMV" in ECMA-262 as e.g. StringMathematicalIdentity returning either an extended mathematical value or -0𝔽?

ECMA-262 StringNumericValue

<emu-grammar>StringNumericLiteral ::: StrWhiteSpace?</emu-grammar>
<emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>
<emu-alg>
  1. Let _x_ be StringMathematicalIdentity of |StrNumericLiteral|.
  1. If _x_ is *-0*<sub>𝔽</sub>, return _x_.
  1. Assert: _x_ is an extended mathematical value.
  1. If _x_ is +∞, return *+∞*<sub>𝔽</sub>.
  1. If _x_ is -∞, return *-∞*<sub>𝔽</sub>.
  1. Return RoundMVResult(_x_).
</emu-alg>

ECMA-402 NumberFormat ToIntlMathematicalValue

 1. Let _literal_ be ParseText(_text_, |StringNumericLiteral|).
-1. If _literal_ is a List of errors, let _mv_ be ~not-a-number~.
-1. Else, let _mv_ be the StringIntlMV of _literal_.
-1. Return _mv_.
+1. If _literal_ is a List of errors, return ~not-a-number~.
+1. Let _x_ be StringMathematicalIdentity of _literal_.
+1. If _x_ is *-0*<sub>𝔽</sub>, return ~negative-zero~.
+1. Assert: _x_ is an extended mathematical value.
+1. If _x_ is +∞, return ~positive-infinity~.
+1. If _x_ is -∞, return ~negative-infinity~.
+1. Return _x_.

(or just use the union of extended mathematical values with {-0𝔽, NaN} directly rather than introducing the spec enum values)

@sffc
Copy link
Collaborator

sffc commented Jan 12, 2023

@romulocintra @bakkot

@sffc sffc added editorial Issue should be resolved in the spec future Out of scope for the current proposal labels Jan 12, 2023
@sffc
Copy link
Collaborator

sffc commented Jan 12, 2023

This is a disruptive editorial change. The current state of how |StringNumericLiteral| works in NFv3 is the result of over a year of work between @romulocintra and @bakkot. I am inclined to wait until after the PR lands in ECMA-402 and then revisit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial Issue should be resolved in the spec future Out of scope for the current proposal
Projects
None yet
Development

No branches or pull requests

2 participants