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: replace functions with arrow functions #6203

Closed

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Apr 14, 2016

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

doc

  • errors
  • vm
Description of change

I replaced "functions" syntax with "arrow functions" syntax.

@mscdex mscdex added the doc Issues and PRs related to the documentations. label Apr 14, 2016
@@ -500,7 +500,7 @@ If you need to support older versions and don't need the worker object,
you can work around the discrepancy by checking the number of arguments:

```js
cluster.on('message', function(worker, message, handle) {
cluster.on('message', (worker, message, handle) => {
if (arguments.length === 2) {
Copy link
Member

Choose a reason for hiding this comment

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

arrow functions do not have the arguments so this wouldn't work.

Copy link
Member Author

@hiroppy hiroppy Apr 15, 2016

Choose a reason for hiding this comment

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

sorry, I overlooked arguments.

@hiroppy hiroppy force-pushed the replace-functions-with-arrow-functions branch from 404cc96 to 1792431 Compare April 15, 2016 07:54
@@ -240,7 +240,7 @@ formatted according to the returned Object. This is similar to how

```js
var obj = { foo: 'this will not show up in the inspect() output' };
obj.inspect = function(depth) {
obj.inspect = (depth) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should replace them in this file, personally.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I return this file.

@hiroppy hiroppy force-pushed the replace-functions-with-arrow-functions branch from 1792431 to f5ae1a6 Compare April 15, 2016 20:02
@thefourtheye
Copy link
Contributor

I am not sure if we really need this to be changed.

@jasnell
Copy link
Member

jasnell commented Apr 18, 2016

There's likely not a pressing need but it also doesn't hurt. LGTM

@Qard
Copy link
Member

Qard commented Apr 18, 2016

I recall some discussion in @nodejs/documentation about some ES6 features, like arrow functions, potentially making examples unclear to those that aren't yet fully familiar with the features. Did we ever come to a consensus on arrow functions? I know the different semantics of this are a bit unexpected to users new to the feature.

@jasnell
Copy link
Member

jasnell commented Apr 18, 2016

Perhaps we need to take some time in the examples to explain the differences then? Perhaps show the example in both forms?

@eljefedelrodeodeljefe
Copy link
Contributor

eljefedelrodeodeljefe commented Apr 18, 2016

I did a PR a while ago for having a visual ES5/ES6 toggle. We rejected it for the amount of duplicated code in the docs back then. We wanted to revisit it at some later time. If this would be interesting again, you guys could put it on the agenda. For now we favor arrow functions though.

Ref: #4915

@jasnell
Copy link
Member

jasnell commented Apr 18, 2016

Hmm.. perhaps a doc/topics addition then? Something that explains the various nuances that exist between ES5 and ES6 ways of doing things.

@benjamingr
Copy link
Member

@eljefedelrodeodeljefe the discussion in the WG meeting was about backticks being visually confusing. I don't think anyone ever suggested discussing it in a docs WG meeting before (but I might be wrong).

That said, these sort of PRs are usually rejected for "creating churn" and not being worth the process around them. Personally I think they're fine but from what I recall that was the consensus.

@jasnell
Copy link
Member

jasnell commented Apr 18, 2016

While they certainly do create a bit of churn, this kind of small doc focused PR is perfect for people who are just getting started in making contributions to Node. They may not be significant changes in their own right, but could open the door to more impactful changes later on.

@benjamingr
Copy link
Member

@jasnell to clarify, I personally agree with that, I was just under the impression my opinion was an unpopular one in Node. I think that given how much we spend trying to encourage contribution getting people accustomed to the PR process is a good thing in its own right.

@eljefedelrodeodeljefe
Copy link
Contributor

Okay. Let's put this on the agenda of the docs WG then. @jasnell are you rather in favor of having small but plenty or big topic/guide?

@jasnell
Copy link
Member

jasnell commented Apr 18, 2016

I would start small-ish and iterate from there.

@techjeffharris
Copy link
Contributor

I think that given how much we spend trying to encourage contribution getting people accustomed to the PR process is a good thing in its own right.

+1 on this; pull requests are intended to invoke discussion. As log as there's plenty of people who are willing to lend a hand to newcomers and we have high conformance with style guides, it should be manageable.

jasnell pushed a commit that referenced this pull request Apr 18, 2016
PR-URL: #6203
Reviewed-By: James M Snell <jasnell@gmail.com>
@jasnell
Copy link
Member

jasnell commented Apr 18, 2016

Landed in 9a9beef

@jasnell jasnell closed this Apr 18, 2016
@Qard
Copy link
Member

Qard commented Apr 19, 2016

Just wanted to add a late 👍 to all that has been discussed. My comment before was not meant to be in protest of this PR or anything, just wanted to be sure we had some defined opinion on arrow functions.

Also agreed that style changes in docs probably shouldn't be considered churn, since it's presentational content rather than operational content.

@eljefedelrodeodeljefe
Copy link
Contributor

Thanks for the follow-up. Starting a discussion about this is the good and right thing 👍

MylesBorins pushed a commit that referenced this pull request Apr 19, 2016
PR-URL: #6203
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
PR-URL: #6203
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
PR-URL: #6203
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Apr 20, 2016
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
PR-URL: #6203
Reviewed-By: James M Snell <jasnell@gmail.com>
This was referenced Apr 21, 2016
MylesBorins pushed a commit that referenced this pull request Apr 21, 2016
PR-URL: #6203
Reviewed-By: James M Snell <jasnell@gmail.com>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request Apr 25, 2016
PR-URL: nodejs#6203
Reviewed-By: James M Snell <jasnell@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 26, 2016
PR-URL: #6203
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 17, 2016
PR-URL: #6203
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this pull request May 18, 2016
PR-URL: #6203
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins MylesBorins mentioned this pull request May 18, 2016
@hiroppy hiroppy deleted the replace-functions-with-arrow-functions branch January 19, 2017 12:28
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants