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

lib: simplify the readonly properties of icu #13221

Closed
wants to merge 1 commit into from

Conversation

JacksonTian
Copy link
Contributor

@JacksonTian JacksonTian commented May 25, 2017

Call Object.defineProperty() twice to set readonly property is
unnecessary.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

lib/internal/bootstrap_node

@nodejs-github-bot nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label May 25, 2017
@mscdex mscdex added i18n-api Issues and PRs related to the i18n implementation. and removed lib / src Issues and PRs related to general changes in the lib or src directory. labels May 25, 2017
@refack
Copy link
Contributor

refack commented May 25, 2017

I'd assume this whole mechanism is necessary if the locale is changed in runtime. @nodejs/intl is there a way to do that?

@@ -28,3 +28,9 @@ assert(/^\d+\.\d+\.\d+(-.*)?$/.test(process.versions.uv));
assert(/^\d+\.\d+\.\d+(-.*)?$/.test(process.versions.zlib));
assert(/^\d+\.\d+\.\d+(\.\d+)?$/.test(process.versions.v8));
assert(/^\d+$/.test(process.versions.modules));

for (let i = 0; i < expected_keys.length; i++) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Can you switch to for(var key of expected_keys) { } instead?

@kunalspathak
Copy link
Member

kunalspathak commented May 26, 2017

I'd assume this whole mechanism is necessary if the locale is changed in runtime.

Good point. But I am wondering if the locale changed at runtime, icu.getVersion(name); would still return the locales present when node instance was bootstrapped.

@JacksonTian
Copy link
Contributor Author

Yes, The locale can be changed, but the ICU version not.

@jasnell
Copy link
Member

jasnell commented Jun 1, 2017

ping @srl295

Call Object.defineProperty() twice to set readonly property is
unnecessary.
@BridgeAR
Copy link
Member

I guess this can land as is?

@jasnell
Copy link
Member

jasnell commented Aug 30, 2017

With fresh CI, yes I believe it can.

@BridgeAR
Copy link
Member

@BridgeAR
Copy link
Member

Landed in 83a5eef

@BridgeAR BridgeAR closed this Aug 30, 2017
BridgeAR pushed a commit that referenced this pull request Aug 30, 2017
Call Object.defineProperty() twice to set readonly property is
unnecessary.

PR-URL: #13221
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Copy link
Member

@srl295 srl295 left a comment

Choose a reason for hiding this comment

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

👍 makes it look too easy

@srl295
Copy link
Member

srl295 commented Aug 30, 2017

@refack no, i don't think there's a mechanism to change the default locale at runtime exposed to node.

@JacksonTian JacksonTian deleted the versions branch September 2, 2017 08:01
addaleax pushed a commit to addaleax/ayo that referenced this pull request Sep 5, 2017
Call Object.defineProperty() twice to set readonly property is
unnecessary.

PR-URL: nodejs/node#13221
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
MylesBorins pushed a commit that referenced this pull request Sep 10, 2017
Call Object.defineProperty() twice to set readonly property is
unnecessary.

PR-URL: #13221
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Sep 10, 2017
MylesBorins pushed a commit that referenced this pull request Sep 12, 2017
Call Object.defineProperty() twice to set readonly property is
unnecessary.

PR-URL: #13221
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Daijiro Wachi <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
@MylesBorins
Copy link
Contributor

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if no let me know or add the dont-land-on label.

@JacksonTian
Copy link
Contributor Author

@MylesBorins It seems the pre-condition #9266 hasn't be backported into v6.x-staging.

@gibfahn
Copy link
Member

gibfahn commented Sep 24, 2017

Left a note on #9266, marking this as don't land for now so we don't keep triaging it for 6.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n-api Issues and PRs related to the i18n implementation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.