idk837384,

All of these are bearable except for Haskell style. Wtf is that😭

LarmyOfLone,

I want a language that takes this and has a specification for the editor to prettify it


<span style="color:#323232;">while x==y
</span><span style="color:#323232;">     func1
</span><span style="color:#323232;">     func2
</span>
sverit,

This is the way

Chrumbs,

Allman is objective the correct choice

reverendsteveii,

Allman is a benign neurosis

Phegan,

Allman is the only other one that has some sanity.

Bienenvolk,

On a serious note tho, I never understood the benefits of GNU’s spaces after functions. I don’t really mind most of the rest but I just don’t get the benefits of ‘funcname (arg)’ vs. ‘funcname(arg)’. Is there a specific reason for this? Personally, I find this to reduce readability because I have to think for a split second whether I’m looking at a variable or a function call.

Of cause this is also due to my habits, but I’m curious as to what the reasoning is.

reverendsteveii,

Honestly I think it’s just “spaces before open parens” and at least it’s consistent. K&R, which I use, wants spaces before the parens in conditionals and loops but not in method sigs or method calls and the linter at work gets me almost every time I type the word “if”.

Bienenvolk,

Fair enough if the GNU dudes valued consistent spacing more than taking function calls as one “logical block”. Not my cup of tea but that’s what configurable auto formatting is for.

Psythik,

If you have ADHD, your coding style is a combination of all of these, and sometimes none of the above.

wer2,

For real, this is why I enable format on save.

thesporkeffect,

The eternal holy wars rage on

BirdyBoogleBop,

Allmans what I learnt then went to K&R on my own because it made more sense to me. I think GNU is fine I guess, not the others though. Not that what I say matters I’ve forgotten how to code and can barely do Hello World these days.

ThatFembyWho,

And who can forget this abomination

while (x == y) { func1(); func2(); }

thesporkeffect,

Aka the bash one-liner

ThatFembyWho,

Some of those made me physically ill.

Like. You do WHAT with your whitespace?!

wer2,

To be fair, some of these look very different in non-C-like languages (e.g. Lisp/Haskell).

zarkanian,
@zarkanian@sh.itjust.works avatar

Crockford gang approves.

barsoap, (edited )

Noone writes Haskell like that. People generate Haskell like that because layout syntax is a fickle beast to generate and outputting braces means you can make mistakes in layout without breaking things, the way the braces and semicolons are output emphasise how they actually don’t matter, they’re also easy to delete in a text editor.

Also it matches up with other Haskellisms, e.g. lists:


<span style="font-weight:bold;color:#a71d5d;">let</span><span style="color:#323232;"> foo </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> [ bar
</span><span style="color:#323232;">          , baz
</span><span style="color:#323232;">          , quux
</span><span style="color:#323232;">          ]
</span>

See how it’s immediately apparent that you didn’t miss a single comma? It’s also trivial to match up opening and closing brackets like that, even in deeply nested situations.

Not doing that is actually my main pet peeve with Rust’s standard formatting.

blackn1ght,

Allman looks fine to me. But I’m a C# dev so maybe I’m just used to it.

nik9000,

It’s not my favorite but it’s fine.

redempt,

Allman changes the way I code. I avoid using imperative constructs so much more because they waste so much more space on my screen.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • 196@lemmy.blahaj.zone
  • GTA5RPClips
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • tacticalgear
  • cubers
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • osvaldo12
  • ngwrru68w68
  • kavyap
  • InstantRegret
  • JUstTest
  • everett
  • Durango
  • cisconetworking
  • khanakhh
  • ethstaker
  • tester
  • anitta
  • Leos
  • normalnudes
  • modclub
  • megavids
  • provamag3
  • lostlight
  • All magazines