The Julia style guide does not mention anything on indention.
Is there any recommendation on indention?
For example in Python the PEP 8 -- Style Guide for Python Code document mentions:
Use 4 spaces per indentation level.
It is mentioned here: https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md#general-formatting-guidelines-for-julia-code-contributions
No, that is the formatting guidelines for contributing Julia code to the Julia project. I was referring to the Julia style guide that is an universal document for the Julia community and not specific to this project.
https://docs.julialang.org/en/v1/manual/style-guide/
I know, but there are no "community global" formatting guidelines.
Should there be?
What do you think @MichaelHatherly?
Not sure if you meant to @
me @vanillajonathan? :smile:
Anyway, @fredrikekre's
I know, but there are no "community global" formatting guidelines.
above is the correct answer.
There is exist https://github.com/invenia/BlueStyle and https://github.com/jrevels/YASGuide.
And although they are not official standards, they are well defined and can serve as a guide.
Also JuliaFormatter.jl can do them.
@MichaelHatherly Yeah I did, because I saw you had committed to the /doc/src/manual/style-guide.md file so I figured you might have a say.
@fredrikekre I thought that was:
https://docs.julialang.org/en/v1/manual/style-guide/
@denius, thanks. Maybe the official one at https://docs.julialang.org/en/v1/manual/style-guide/ should have a mention of indention too.
No, that is the formatting guidelines for contributing Julia code to the Julia project. I was referring to the Julia style guide that is an universal document for the Julia community and not specific to this project.
The PEP you mention:
This document gives coding conventions for the Python code comprising the standard library in the main Python distribution.
A language can't really dictate what the community does. I'm however ok with pointing out good indenting (which isn't meaningful, unlike in Python), style in general, if it isn't done already. I.e. to the tools, and at least the most relaxed style-guide (one is a common-subset of all of them? What the tool does be default.).
@fredrikekre I thought that was: https://docs.julialang.org/en/v1/manual/style-guide/
If you read that page you see that nothing there is really about formatting. I don't have a problem of including something like https://github.com/JuliaLang/julia/blob/master/CONTRIBUTING.md#general-formatting-guidelines-for-julia-code-contributions on that page and mentioning that that is what the base language uses. Perhaps it is also fine to point to e.g. JuliaFormatter.
@PallHaraldsson
A language can't really dictate what the community does. I'm however ok with pointing out good indenting (which isn't meaningful, unlike in Python), style in general, if it isn't done already.
I am not suggesting that the language should dictate what the community does, I just suggest that just like many other languages there should be a "style guide" or a "coding conventions" document.
This way code can be more uniform, easier to integrate and re-use, and different tools and editors can default to the same indention setting.
@fredrikekre
If you read that page you see that nothing there is really about formatting.
Yes, the page does not have anything on formatting. I think it should. I think it would be good if it mentioned indention.
If need be, I'm willing to dictate that four spaces is the correct Julian indentation style and anyone deviating from that is a heretic and their heresy shall be punished by a stern glare from a viking.
Most helpful comment
There is exist https://github.com/invenia/BlueStyle and https://github.com/jrevels/YASGuide.
And although they are not official standards, they are well defined and can serve as a guide.
Also JuliaFormatter.jl can do them.