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: 'constructor' implies use of new keyword #17364

Closed
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
@CameronMoorehead
Contributor

CameronMoorehead commented Nov 28, 2017

the square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

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

doc

doc: 'constructor' implies use of new keyword
the square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.
@addaleax

Can you also turn square into Square in this case? It’s a bit more common to start constructor names with a capital letter

@maclover7

LGTM once @addaleax's comment is addressed

CameronMoorehead added some commits Nov 28, 2017

@CameronMoorehead

This comment has been minimized.

Show comment
Hide comment
@CameronMoorehead

CameronMoorehead Nov 28, 2017

Contributor

Very good point. Updated.

Contributor

CameronMoorehead commented Nov 28, 2017

Very good point. Updated.

@Trott

This comment has been minimized.

Show comment
Hide comment
@Trott

Trott Nov 28, 2017

Member

No objection, but a simpler fix might be to leave the code as is and simply remove the words which exports a constructor from the text.

Member

Trott commented Nov 28, 2017

No objection, but a simpler fix might be to leave the code as is and simply remove the words which exports a constructor from the text.

apapirovski added a commit to apapirovski/node that referenced this pull request Dec 7, 2017

doc: 'constructor' implies use of new keyword
The square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

PR-URL: nodejs#17364
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
@tniessen

This comment has been minimized.

Show comment
Hide comment

apapirovski added a commit that referenced this pull request Dec 9, 2017

doc: 'constructor' implies use of new keyword
The square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

PR-URL: #17364
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
@apapirovski

This comment has been minimized.

Show comment
Hide comment
@apapirovski

apapirovski Dec 9, 2017

Member

Landed in 1449c18

Thanks for the contribution @CameronMoorehead! Congrats on becoming a Contributor!! 🎉

Member

apapirovski commented Dec 9, 2017

Landed in 1449c18

Thanks for the contribution @CameronMoorehead! Congrats on becoming a Contributor!! 🎉

@apapirovski apapirovski closed this Dec 9, 2017

@charmander

This comment has been minimized.

Show comment
Hide comment
@charmander

charmander Dec 9, 2017

Contributor

Shouldn’t the example square.js be changed as well? It exports an arrow function, so new will throw outright.

Contributor

charmander commented Dec 9, 2017

Shouldn’t the example square.js be changed as well? It exports an arrow function, so new will throw outright.

@apapirovski

This comment has been minimized.

Show comment
Hide comment
@apapirovski

apapirovski Dec 9, 2017

Member

@charmander Yes. 👍PR coming up... this is what happens when no one clicks to see the rest of the code 😆

Member

apapirovski commented Dec 9, 2017

@charmander Yes. 👍PR coming up... this is what happens when no one clicks to see the rest of the code 😆

@apapirovski apapirovski referenced this pull request Dec 9, 2017

Closed

doc: fix modules.md export example #17579

3 of 3 tasks complete

apapirovski added a commit that referenced this pull request Dec 12, 2017

doc: fix modules.md export example
Arrow functions cannot be called with the new keyword,
convert to ES6 classes instead.

PR-URL: #17579
Refs: #17364
Reviewed-By: Rich Trott <rtrott@gmail.com>

MylesBorins added a commit that referenced this pull request Dec 12, 2017

doc: 'constructor' implies use of new keyword
The square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

PR-URL: #17364
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>

MylesBorins added a commit that referenced this pull request Dec 12, 2017

doc: fix modules.md export example
Arrow functions cannot be called with the new keyword,
convert to ES6 classes instead.

PR-URL: #17579
Refs: #17364
Reviewed-By: Rich Trott <rtrott@gmail.com>

MylesBorins added a commit that referenced this pull request Dec 12, 2017

doc: 'constructor' implies use of new keyword
The square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

PR-URL: #17364
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>

MylesBorins added a commit that referenced this pull request Dec 12, 2017

doc: fix modules.md export example
Arrow functions cannot be called with the new keyword,
convert to ES6 classes instead.

PR-URL: #17579
Refs: #17364
Reviewed-By: Rich Trott <rtrott@gmail.com>

@MylesBorins MylesBorins referenced this pull request Dec 12, 2017

Merged

v9.3.0 proposal #17631

@addaleax addaleax removed the author ready label Dec 13, 2017

gibfahn added a commit that referenced this pull request Dec 20, 2017

doc: 'constructor' implies use of new keyword
The square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

PR-URL: #17364
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>

gibfahn added a commit that referenced this pull request Dec 20, 2017

doc: 'constructor' implies use of new keyword
The square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

PR-URL: #17364
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>

gibfahn added a commit that referenced this pull request Dec 20, 2017

doc: fix modules.md export example
Arrow functions cannot be called with the new keyword,
convert to ES6 classes instead.

PR-URL: #17579
Refs: #17364
Reviewed-By: Rich Trott <rtrott@gmail.com>

@gibfahn gibfahn referenced this pull request Dec 20, 2017

Closed

v8.9.4 proposal #17772

gibfahn added a commit that referenced this pull request Dec 20, 2017

doc: 'constructor' implies use of new keyword
The square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

PR-URL: #17364
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>

gibfahn added a commit that referenced this pull request Dec 20, 2017

doc: fix modules.md export example
Arrow functions cannot be called with the new keyword,
convert to ES6 classes instead.

PR-URL: #17579
Refs: #17364
Reviewed-By: Rich Trott <rtrott@gmail.com>

@gibfahn gibfahn referenced this pull request Dec 20, 2017

Merged

v8.9.4 proposal #17774

@MylesBorins MylesBorins referenced this pull request Dec 20, 2017

Merged

v6.12.3 proposal #17776

gibfahn added a commit that referenced this pull request Dec 20, 2017

doc: fix modules.md export example
Arrow functions cannot be called with the new keyword,
convert to ES6 classes instead.

PR-URL: #17579
Refs: #17364
Reviewed-By: Rich Trott <rtrott@gmail.com>

msoechting added a commit to hpicgs/node that referenced this pull request Feb 5, 2018

doc: 'constructor' implies use of new keyword
The square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

PR-URL: nodejs#17364
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>

msoechting added a commit to hpicgs/node that referenced this pull request Feb 5, 2018

doc: fix modules.md export example
Arrow functions cannot be called with the new keyword,
convert to ES6 classes instead.

PR-URL: nodejs#17579
Refs: nodejs#17364
Reviewed-By: Rich Trott <rtrott@gmail.com>

msoechting added a commit to hpicgs/node that referenced this pull request Feb 7, 2018

doc: 'constructor' implies use of new keyword
The square module is described as exporting a constructor,
which would mean it would need to be invoked with the
new keyword in bar.js after requiring it. Otherwise it's
technically a factory function, not a constructor.

PR-URL: nodejs#17364
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>

msoechting added a commit to hpicgs/node that referenced this pull request Feb 7, 2018

doc: fix modules.md export example
Arrow functions cannot be called with the new keyword,
convert to ES6 classes instead.

PR-URL: nodejs#17579
Refs: nodejs#17364
Reviewed-By: Rich Trott <rtrott@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment