-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
doc: require() tries first core not native modules #10324
Conversation
Could someone briefly clarify the difference between native and core? |
@reecehudson As I understand it, core modules are ones built into Node itself, things in ./lib like |
Native is a module compiled in machine "native" code. Core modules form Node's "core" functionalities. I suppose all core are native but it could be possible to have a core module not native and written completely in JavaScript. |
@@ -368,7 +368,7 @@ example, then `require('./some-library')` would attempt to load: | |||
|
|||
<!--type=misc--> | |||
|
|||
If the module identifier passed to `require()` is not a native module, | |||
If the module identifier passed to `require()` is not a core module, |
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.
Maybe better to specify it as built-in core module
?
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.
There are core modules which are not built-in?
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.
The word "core" isn't defined, I would use the word "built-in", its more descriptive, and more accurate.
Btw:
All core modules are native but not all native modules are in core.
This is not true. There are native modules built-in to node, but there are also lots of javascript modules built-in to node, see https://github.com/nodejs/node/tree/master/lib, and user's of the Node.js API can't tell the difference between native and javascript built-in modules, to my knowledge.
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.
"Core Modules" is defined earlier in the same document: https://nodejs.org/dist/latest-v7.x/docs/api/modules.html#modules_core_modules
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.
Thanks @richardlau. I'm OK then with the text proposed, but suggest the word "core module" be linked to the definition.
@@ -368,7 +368,7 @@ example, then `require('./some-library')` would attempt to load: | |||
|
|||
<!--type=misc--> | |||
|
|||
If the module identifier passed to `require()` is not a native module, | |||
If the module identifier passed to `require()` is not a core module, |
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.
The word "core" isn't defined, I would use the word "built-in", its more descriptive, and more accurate.
Btw:
All core modules are native but not all native modules are in core.
This is not true. There are native modules built-in to node, but there are also lots of javascript modules built-in to node, see https://github.com/nodejs/node/tree/master/lib, and user's of the Node.js API can't tell the difference between native and javascript built-in modules, to my knowledge.
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ .
I just changed the commit following reviews and requested changes. Now I know that non native built-in core modules exist :-) |
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Change a single word in documentation with a more precise one. Native is a module compiled in machine "native" code. A module normally written in a compiled language, not in JavaScript. Core modules form Node's built-in "core" functionalities. You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ . PR-URL: #10324 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
All core modules are native but not all native modules are in core.
Checklist
Affected core subsystem(s)
doc
Description of change
Change a single word in documentation with a more precise one.