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

doc: require() tries first core not native modules #10324

Closed
wants to merge 1 commit into from

Conversation

vice
Copy link
Contributor

@vice vice commented Dec 18, 2016

All core modules are native but not all native modules are in core.

Checklist
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

doc

Description of change

Change a single word in documentation with a more precise one.

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. module Issues and PRs related to the module subsystem. lts-watch-v6.x labels Dec 18, 2016
@nouex
Copy link

nouex commented Dec 19, 2016

Could someone briefly clarify the difference between native and core?

@gibfahn
Copy link
Member

gibfahn commented Dec 19, 2016

@reecehudson As I understand it, core modules are ones built into Node itself, things in ./lib like http and fs. Native modules are modules that use C++ (not just Javascript) and must be compiled for a particular system.

@vice
Copy link
Contributor Author

vice commented Dec 19, 2016

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 "core" functionalities.
You don't need to install them. They are included in every Node installation and documented in https://nodejs.org/api/ .

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,
Copy link
Contributor

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?

Copy link
Member

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?

Copy link
Contributor

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.

Copy link
Member

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

Copy link
Contributor

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,
Copy link
Contributor

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/ .
@vice
Copy link
Contributor Author

vice commented Dec 20, 2016

I just changed the commit following reviews and requested changes.
I rewrite git history in my branch replacing older commit with an improved one.
I don't known if there is a better way to comply.

Now I know that non native built-in core modules exist :-)

jasnell pushed a commit that referenced this pull request Dec 23, 2016
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>
@jasnell
Copy link
Member

jasnell commented Dec 23, 2016

Landed in f4cda23
(edit by @addaleax: used full SHA since the short one was ambiguous o.o)

@jasnell jasnell closed this Dec 23, 2016
evanlucas pushed a commit that referenced this pull request Jan 3, 2017
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>
evanlucas pushed a commit that referenced this pull request Jan 4, 2017
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>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
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>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
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>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
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>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
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>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
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>
This was referenced Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Jan 31, 2017
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>
MylesBorins pushed a commit that referenced this pull request Feb 1, 2017
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. module Issues and PRs related to the module subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.