4 ms·
Some food for thought: https://youtu.be/ZsHMHukIlJY?t=633 https://youtu.be/ZsHMHukIlJY?t=633 For example, this is the best way to define functions with argumen
by Mawr 7y ago
Some food for thought: https://youtu.be/ZsHMHukIlJY?t=633 https://youtu.be/ZsHMHukIlJY?t=633
For example, this is the best way to define functions with argument lists long enough not to fit on a single line:
fn doThing(
argument1,
argument2,
argument3,
) {
<code>
}
Visually clear, doesn't have any spaces/tabs issues, produces minimal diffs when adding/removing/renaming arguments.
- Stratoscope 7y agoVery 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: https://news.ycombinator.com/item?id=18962177 https://news.ycombinator.com/item?id=18962177