-
Notifications
You must be signed in to change notification settings - Fork 106
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
Should all new constructors throw when called as a function? #384
Comments
It seems better to make them behave like the class keyword, otherwise they won’t be ergonomically self hostable in JS by implementations. |
Well, that's already the case for Intl.{Collator,NumberFormat,DateTimeFormat}, so no matter what such implementations will require code similar to |
General consensus (in ECMA-402 and ECMA-262) is that any new built-in constructor should require |
Is there any action required on this issue? Do we need to document the decision somewhere? Or can we just close it? |
I believe it's fine to close this, we can discuss (IMO directly in a new PR) if we want to add a note to the specs about this, like in #463. |
Every constructor except PluralRules is specified to be callable as a function and supported as such:
PluralRules is intentionally different per tc39/proposal-intl-plural-rules#24 , but the door was left open to bring it in line with the rest of spec. Can we reach consensus on whether or not the behavior of Collator, NumberFormat, and DateTimeFormat when called as a function is to be treated as the ECMA 402 convention or as an abandoned legacy, and document accordingly in https://tc39.es/ecma402/#locale-and-parameter-negotiation ?
The text was updated successfully, but these errors were encountered: