-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Replace vague 'may not' with definitive 'will not' #23143
Conversation
This vagueness of 'may' has caused a great deal of confusion. See https://stackoverflow.com/questions/8887318/understanding-node-js-modules-multiple-requires-return-the-same-object
CI-lite: https://ci.nodejs.org/job/node-test-pull-request-lite-pipeline/1050/ (Not sure why CI shows different commit though) |
Node.js Collaborators, please, add 👍 here if you approve fast-tracking. |
If you're referring to |
/CC @nodejs/modules |
The |
It could potentially be clarified that this will not happen under default circumstances. Once you modify the require cache all bets are off. |
doc/api/modules.md
Outdated
@@ -200,7 +200,7 @@ Modules are cached after the first time they are loaded. This means | |||
(among other things) that every call to `require('foo')` will get | |||
exactly the same object returned, if it would resolve to the same file. | |||
|
|||
Multiple calls to `require('foo')` may not cause the module code to be | |||
Multiple calls to `require('foo')` will not cause the module code to be |
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.
It’s “may” because someone could have deleted it from require.cache - i think “will” is incorrect.
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.
Updated as requested
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.
Typo.
Updated per @Fishrock123 - now it's more specific:
|
doc/api/modules.md
Outdated
executed multiple times. This is an important feature. With it, | ||
"partially done" objects can be returned, thus allowing transitive | ||
dependencies to be loaded even when they would cause cycles. | ||
By default (provided the `require.cache` is not modified), multiple calls to |
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.
Optional nit: Get rid of By default
and the parentheses:
Provided `require.cache` is not modified, multiple calls to
I'm fine with it the way it is but I think that change makes it a tiny bit more clear.
doc/api/modules.md
Outdated
By default (provided the `require.cache` is not modified), multiple calls to | ||
`require('foo')` will not cause the module code to be executed multiple times. | ||
|
||
This is an important feature. With it, "partially done" objects can be returned, |
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.
This line has trailing space and exceeds the limit of 80 characters producing linter issue.
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 with @Trott nit.
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.
Removing author ready label as there are some outstanding comments
Since the comments were rather minor (remove a space here, optionally change wording there), I did them rather than waiting for OP to do it and have restored the |
Thanks Rich! I can enjoy the rest of my weekend 😀
…On Sun, 30 Sep 2018 at 5:43 pm, Rich Trott ***@***.***> wrote:
Since the comments were rather minor (remove a space here, optionally
change wording there), I did them rather than waiting for OP to do it and
have restored the author ready label.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#23143 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAKiMh16ZcGm-8XxDsho6Kc6qNL8Ajh7ks5ugPS2gaJpZM4W-TUm>
.
|
Landed in a82ac6e |
This vagueness of 'may' has caused a great deal of confusion. See https://stackoverflow.com/questions/8887318 PR-URL: #23143 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: John-David Dalton <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
This vagueness of 'may' has caused a great deal of confusion. See https://stackoverflow.com/questions/8887318 PR-URL: #23143 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: John-David Dalton <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
This vagueness of 'may' has caused a great deal of confusion. See https://stackoverflow.com/questions/8887318/understanding-node-js-modules-multiple-requires-return-the-same-object
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes