On Thursday, 1 June 2023 at 09:37:43 UTC, Dukc wrote:
On Wednesday, 31 May 2023 at 16:24:38 UTC, Cecil Ward wrote:
I wanted to ask how some of the leaders of our group feel
about D indentation standards. `i realise that this causes
some religious fervour in C. I could be in trouble here
because in all my years at work, we never used K & R ‘one true
brace style’ indenting, with the house style I’m used to being
more like whitesmiths. Wikipedia explains this better.
Something like the following below.
So my question: would I get lynched for the following? (below)
Check out this module from me:
https://github.com/dukc/nuklearbrowser/blob/master/source/nuklearbrowser.d
Plus similar style in most of my posts and bug reports. I'm
still alive :D.
Your code is your code. There, you may do as you wish. You have
to aknowledge that an esoteric style may make it more difficult
to read for some, but we're not lynching people for other
factors of code readability either. Brace style is no different.
Plus, what brace style is considered readable by the majority
is a culture issue. There has to be some way to challege the
established culture. If you don't exercise your power to code
as you wish, someone will make your choice for you. Coding
culture, or even culture in general, cannot develop if people
never challege the present status quo.
When you're coding with others, though, then you should obey
the style guideline of that project if there is one. Even there
you're as entitled as anyone for an opinion what the style
policy should be (and to whether there should be style policy
at all), but you then should (usually) obey the decision
regardless whether it's the one you were advocating for.
I wonder how much work it would be to write a D pretty printer /
beautifier. Doing things such as lining up parameters or comments
and breaking and re-wrapping comments etc if necessary because of
the changes in whitespace.
I’ve no idea what the ‘official story’ is with nested functions.
I have some experience with that because I used to write Pascal
(on a Z80 box and on a VAX), and that feature is like the return
of an old friend, I love it so much and for me it’s quite a
serious advantage over C.
I’m always guilty of overcommenting, for various reasons although
I’m not guilt of the likes of /* add 1 to x */! ;-) It’s partly
because I have a shocking memory and maintenance becomes
literally impossible for me, for me just as important I want the
comments to spell out original intent, not the implementation
choices, so if you see later that the two don’t match then you’ve
spotted the bug.
Many people comment in a very minimal way which makes the code
look neat.
I did sort of find an /* add 1 to x */ though as it was
explaining and giving a caveat about GCC in-line asm constraints,
and the comment saved me having to go and look things up in the
bible.