John,
Thanks for doing this. I agree with you that consistent code styles have
lots of benefits.
I read through your draft, and agree with many of the points there, except
the following:
(6) Never place more than 80 characters on a line.
I agree that overly long lines hurt readability. However, I think a hard
threshold of 80 chars is too restrictive. Just take a quick skim of the
Julia code base, you will find plenty of lines well beyond this limit (even
lines over 120 chars are not uncommon).
This is kind of related to some of the Julia's language features (e.g.
parameter annotation, and one-line definition of functions, etc). In such
cases, code lines that are a little bit longer wouldn't make a big problem.
I found it sometimes even more annoying to break lines simply for the sake
of the fitting some limit on line length.
I would suggest rephrasing this to something like (avoid excessively long
code lines) instead of setting a hard limit.
(10) ... the spacing before-and-after rule applies to keyword arguments ...
This seems to contradict the convention of Julia code base. I also found
that the function declaration is easier to read without spaces before/after
the default value for keyword arguments.
Besides this, I found that this article have spaces between the type
arguments and its super type. For example foo{T <: S}( ... ). This also
contradicts the Julian convention.
Other comments:
- It is good to have things together. Julia already have a style
guideline <http://docs.julialang.org/en/latest/manual/style-guide/>. It
would be easer for users to follow if we incorporate these rules into that
page instead of setting up a separate set of guidelines.
- The section for performance would be moved to something such as a
performance guideline.
Happy New Year!
Cheers,
Dahua
On Tuesday, December 31, 2013 9:01:23 AM UTC-6, John Myles White wrote:
>
> One of the things that I really like about working with the Facebook
> codebase is that all of the code was written to comply with a very thorough
> internal style guideline. This prevents a lot of useless disagreement about
> code stylistics and discourages the creation of unreadable code before
> anything reaches the review stage.
>
> In an attempt to emulate that level of thoroughness, I decided to extend
> the main Julia manual’s style guide by writing my own personal style
> guideline, which can be found at
> https://github.com/johnmyleswhite/Style.jl
>
> I’d be really interested to know what others think of these rules and what
> they think is missing. Right now, my guidelines leave a lot of wiggle room.
>
> — John
>
>