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

Clean up kernel platform #3199

Closed
wants to merge 10 commits into from
Closed

Clean up kernel platform #3199

wants to merge 10 commits into from

Conversation

kodnin
Copy link
Contributor

@kodnin kodnin commented Nov 11, 2014

Cleaned up the syntax in kernel/platform. Changes focus on indentation, whitespace, single quoted strings, method invocation with parentheses, or, and and return statements.

@kodnin
Copy link
Contributor Author

kodnin commented Nov 11, 2014

Before actually merging this stuff in, we might want to discuss standards on syntax. The styleguide Rubinius provides is rather liberal. Did the Rubinius community consider using Rubocop (or Pronto) or commiting to the Ruby styleguide before?

@yorickpeterse
Copy link
Contributor

There are a few things worth noting here:

  1. Rubinius.primitive calls should not be touched unless one knows what they do. While they look like method calls they are special compiler instructions that will result in C++ code being bound to it. This allows us to call C++ routines from Ruby. I'm not 100% sure if adding parenthesis here would actually break the compiler, but I'd just leave it as is.
  2. Typically we don't really use parenthesis for DSL methods (e.g. FFI's attach_function calls).
  3. Changing double quotes to single quotes (or the other way around) just for the sake of it isn't really needed. The potential "performance overhead" people often attach to double quotes is total nonsense as it will be only 0,00000000000000000001% of your total workload (if it even attributes to it at all). While I don't care much about people changing it, it does add a lot of unwanted noise to this pull-request. It might be best to split that up if deemed important enough.

So tl;dr: Rubinius.primitive lines should not be changed, just adding parenthesis for the sake of it doesn't help much either. Indentation fixes however are perfectly fine in my book.

Style wise, in general Rubinius doesn't strictly follow any "official" (read: decided by several members of the community) style guides other than the one defined on the Rubinius website. We certainly don't use any tools to enforce them either. The primary reason is that it doesn't really help us to have some tool bark at developers when they use an explicit return or forget a space somewhere. These tools often don't give a solid reason as to why something is wrong. When somebody has questions about style and/or syntax it's better to receive a human response, opposed to a response from a computer.

@jemc
Copy link
Member

jemc commented Nov 11, 2014

In my opinion, many of these changes make the code uglier, which in turn illustrates the difficulty in coming to a consensus about rigid style rules.

@kodnin
Copy link
Contributor Author

kodnin commented Nov 11, 2014

@yorickpeterse, I do agree with you on the parentheses. After submitting the PR it felt a bit dirty. I will remove them somewhere tomorrow. I do not agree on the double to single quotes. I did not make these changes with performance in mind (though I am aware of their benefit). I think they primarily show some intent. Here is a simple plain string, or here is a string in which something interesting is going to happen.

@jemc, besides the parentheses (which I will gladly remove), what parts are you referring to?

@southerngs
Copy link
Contributor

I don't have an opinion as to whether this makes the code uglier or prettier. But I would prefer not to see large commits that are just adjusting spacing and/or other minor formatting issues. It makes it harder to merge the mainline with the branch I'm working on, and the commit doesn't appear to have any functional purpose.

@kodnin
Copy link
Contributor Author

kodnin commented Nov 11, 2014

@southerngs, you are definitely right. I assumed there was no active work on these files in other branches. (Most files where not touched in the last year.) Learned yet another thing, thanks.

@kodnin
Copy link
Contributor Author

kodnin commented Nov 12, 2014

In the end I think it is better to just close this pull request. I do not want to complicate other work by just fixing indentation and some other minor issues. Thank you for your reflections, I learned something there on the code itself and collaboration.

For the future I hope there will be more clear guidelines on style, but I am not sure how to address this topic properly and start the discussion in the community.

@chuckremes
Copy link
Member

David,

We really appreciate the effort that you put in. Every little bit helps. I think you have already started the conversation about guidelines, so why not open an issue on this topic (and close this PR) and we can continue it there.

We learned a few things. One, DSLs generally don’t have parentheses. If that isn’t in the Rubinius style guide then we have an obvious patch to make to the guide. Second, there is no clear guideline on where/when to use single versus double quotes. Again, if that isn’t in the style guide then we have a discussion point for a second patch.

The style guide should be part of the rubinius docs which are in its own repository, so PRs can be opened against it just like for code. If you would like to discuss these issues in real-time, then you may consider joining the #rubinius channel at irc.freenode.net. It’s usually pretty active though not necessarily for all timezones.

Thank you for your contribution to the community. Even though this first PR isn’t going to make it in, it’s a good bet that your second (and third and nth) will. Don’t give up!

On Nov 12, 2014, at 4:07 AM, David Boot notifications@github.com wrote:

In the end I think it is better to just close this pull request. I do not want to complicate other work by just fixing indentation and some other minor issues. Thank you for your reflections, I learned something there on the code itself and collaboration.

For the future I hope there will be more clear guidelines on style, but I am not sure how to address this topic properly and start the discussion in the community.


Reply to this email directly or view it on GitHub.

@yorickpeterse
Copy link
Contributor

Am I right in understanding this PR can be closed?

@jc00ke
Copy link
Member

jc00ke commented Nov 14, 2014

Yeah, and hopefully we can flesh out the style guide over in the docs.

@jc00ke jc00ke closed this Nov 14, 2014
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.

None yet

6 participants