Re:Hobby x86 kernel written with Zig
by Stratoscope on Monday January 06, 2020 @09:22PM
(#21976139)
Very interesting talk! Thanks for the reference.
More food for thought:
The style in your example is more consistent with the way nearly every programmer formats code that has more than one statement. For example:
if( shouldDoThings ) {
doOneThing();
doAnotherThing();
doLastThing();
}
Why do we want to format statements that way, but function calls and expressions a different way? No one would write this: if (shouldDoThings) {doOneThing();
doAnotherThing();
doLastThing();}
I have a theory about that but will have to save it for another day.Somewhat related, the Rust coding style guidelines used to follow a heavily column-aligned style, but changed to indentation-only a year or two ago. I posted an example from the Servo source code with the old and new formats here:
For example, this is the best way to define functions with argument lists long enough not to fit on a single line:
Visually clear, doesn't have any spaces/tabs issues, produces minimal diffs when adding/removing/renaming arguments.