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

Added general recommendations #4002

Closed
wants to merge 2 commits into from
Closed

Conversation

mesqueeb
Copy link
Contributor

No description provided.


* Private functions

It's convention to start private function names with an underscore (`_`). e.g. `_myPrivateFunction`
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about this. Is any project doing this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is one project: Crypto Zombies
at lesson 1 chapter 9

Copy link
Member

Choose a reason for hiding this comment

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

There needs to be a bit stronger concensus if we put into the guide claiming it is a convention.

Copy link
Contributor Author

@mesqueeb mesqueeb Apr 27, 2018

Choose a reason for hiding this comment

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

@axic
They probably took it from the fact that it's a convention in languages like Python, PHP and other OOP languages. However in JS since everything is public, there are some discussions wether to do that or not. Also seen in the React and NPM source code.

But I guess any Styling convention comes down to preference really...

Copy link
Contributor

Choose a reason for hiding this comment

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

And exactly because it comes down to preference I would rather not put naming conventions in a styling guide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I must say the Function parameter variable names I have seen in many places and do think it's useful. Maybe we can just scratch out the private function name one?

Copy link
Contributor

Choose a reason for hiding this comment

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

The convention in python also comes from the fact that you cannot mark members as private (or at least you were not able to in previous versions). I think PHP is similar.

TODO
* Function parameter variable names

It's convention to start function parameter variable names with an underscore (`_`) in order to differentiate them from global variables. e.g. `function myFunction(_foo, _bar) { }`
Copy link
Member

Choose a reason for hiding this comment

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

This looks good.

Copy link
Member

@axic axic left a comment

Choose a reason for hiding this comment

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

Since the format is RST (restructured text), it uses double backticks where Markdown would use one.

@erak
Copy link
Collaborator

erak commented May 2, 2018

I'd rather not add this as a convention, but as a suggestion or guideline. As much as I'm in favor of conventions, I think we should leave this up to the users.

@chriseth
Copy link
Contributor

This recommendation conflicts with the other naming conventions, so I fear we have to close this.

@chriseth chriseth closed this May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants