-
Notifications
You must be signed in to change notification settings - Fork 68
Quickstart edits #255
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
Quickstart edits #255
Conversation
- seemed to be a preference for 4 space indendation so I took that everywhere. I indented also module and program bodies - the C struct example I think didn't properly match - ...
- indent `contains` - code literal style for code identifiers instead of emphasis
Code: - `...` -> `! ...` so no red box around it in the syntax highlighting - consistent-ify some things
- consistentify - 2 spaces precede inline comment - `do` syntax
Oxford comma is a nice thing I think
It should be 3.141593, not 3.141592, since pi = 3.14159265... But using 3.1415927 seems to give the same accuracy as `4*atan(1.)` Some experiments I did: 3.14159 -> 3.14159012 3.141592 -> 3.14159203 3.141593 -> 3.14159298 3.1415927 -> 3.14159274 3.1415926 -> 3.14159250 3.14159265 -> 3.14159274 4*atan(1.) -> 3.14159274
I'm personally in the 3 space indentation fraction, but we usually consider using 2 or 4 spaces here. Most important is readability w.r.t. horizontal space IMO, the code block shouldn't get clamped on the right side due to over-indented code. The code blocks on the homepage can have a width of 80 to 90 characters before horizontal scrolling is necessary in our current page layout. This shouldn't be an issue in the quickstart guide but could be an issue for other minibooks which require more complex examples. I think either two spaces and indentation of every unit (something, end something), like used now in the quickstart guide: module m
implicit none
private
public :: a_t
type :: a_t
integer :: val
contains
procedure :: func
end type a_t
contains
subroutine func(self)
class(a_t), intent(in) :: self
if (val > 0) then
print *, val
end if
end function func
end module m Or four space indentation only for non-procedure / module units (I think this is @certik's preferred style, I usually find this hard to read): module m
implicit none
private
public :: a_t
type :: a_t
integer :: val
contains
procedure :: func
end type a_t
contains
subroutine func(self)
class(a_t), intent(in) :: self
if (val > 0) then
print *, val
end if
end function func
end module m |
On mobile in portrait mode, the number of viewable columns can be even less. I am seeing that longer lines get soft-wrapped, which can be a bit confusing since the rendered blocks don't currently have line numbers. Perhaps optional code block line numbers or horizontal scroll bars could be added. I think 90 is a reasonable max and inline comments shouldn't go too far over it. |
Many thanks for looking into this Zachary @zmoon . For most of your points, as long as the style is consistent across the tutorials then the particular choice doesn't matter too much. Re indentation, I think we should go with 2 spaces with zero base indentation for reasons already discussed, and my preference would be to indent module procedures for readability as suggested by Sebastian. I would also like to avoid vertical aligning of
I'm not sure what is meant by this, please remove or reword as you see fit.
Yes absolutely, this would make a good addition to the quickstart tutorial. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the trailings were introduced by me yesterday...
Thanks @awvwgk, @LKedward, @milancurcic for the comments so far. I will draw up tutorial style guidelines for the Style Guide and then wait for feedback on that before enforcing it across the Quickstart pages. I will do a separate PR for page on formatted print. |
Yes for tutorials let's use zero based indentation and 2 spaces, essentially spare as much as we can, so that it's reasonable on mobile also. (For my codes I prefer 4 spaces, but I think the tutorial use case is different.) |
Ok, I started the style guidelines (here). Feel free to comment. What about spaces after |
Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
My preference is to omit whitespace in procedure calls, e.g. |
Style guide additions look good to me, thanks! I think your suggestion for spacing around commas seems reasonable to me. |
@LKedward I still have a few things I want to do first but I will be sure to mark ready after that, thanks. |
@milancurcic could you (or someone else) explain what is meant by " |
I think the comment on
|
Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
So maybe the first sentence in the note, " Is there a resource comparing what the different major compilers can/will do with it? |
Maybe we can just put a general statement there that concurrency does not imply parallel execution. Not sure what GFortran does, but |
Cool. Yeah I just feel since it's for the Quickstart we should mention that compiler flags are necessary to get parallelization, and maybe mention a few (maybe should be |
@awvwgk I made some changes to the |
@LKedward do you want to review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay in reviewing - this is great work @zmoon! A significant improvement and it's great to have a set guidelines for styling future mini-books. Very minor, but you could mention the use of the Oxford comma in the Text section of the style guide for future consistency. Other than that I haven't spotted any issues with these changes. Many thanks!
#build_preview |
This PR has been built with Jekyll and can be previewed at: https://fortran-lang.org/pr/255/ |
Sorry @zmoon, yes those CSS updates look fine to me and the rendering seems to work better now for narrow screens 👍 |
With three approvals I will go ahead and merge this patch. |
#delete_preview |
The preview build for this PR has now been deleted. |
I'm doing a bit of an audit of the Quickstart Fortran Tutorial. So far I mostly corrected some English stuff and tried to make the code style consistent within each page (but not across all pages).
I would like to make style consistent across the whole tutorial though, but that requires deciding on some things that are currently not consistent among all pages:
contains
rt.module
, similarly for typecontains
,
(do
loop, arguments, indexing, etc.)::
and inline comments. Important?code
I also have some content questions:
do concurrent
is not a basic feature of Fortran" in Operators and Control Flow?