One of the benefits of the haskell style is easy commenting of the additional functions. I do something similar in my python scripts when testing several differnent chunks of code.
But then again I chose a career in GIS so I probably have a mental disorder.
This is true, but it also moves the discussion to which is the superior code for matter for languages that don't have a clear default option, and of course to which languages have the best formatters.
I have a hard stance in this question - code formatters should be deterministic on any given syntax tree - there should be no leeway for choosing how any given piece of code formats. Seriously. If your anti-bikeshedding tool does not completely eliminate the bikeshedding, you have not done your job correctly.
Ew. I usually don't use curly braced languages. But whenever I need to define collections on multiple lines I always put opening bracket on the end of the line and closing bracket on the same indent level as the start of the statement:
let hello = [
"Hello, there!",
]
var
a = true
arr = [
"line 1",
"line 2",
]
19 Comments
green_square@yiffit.net · 29 pts · 2y
Can we all agree haskell style is a mental disorder?
street_pigeons@lemmy.world · 15 pts · 2y
I think it's trying to keep track of all the semicolons but my god does it look strange
littletranspunk@lemmus.org · 9 pts · 2y
I might just do that style just to make my professor cringe on my next c# assignment
"I mean, it's right, it runs, but it looks like shit"
surewhynotlem@lemmy.world · 5 pts · 2y
You might get a kick out of this
https://en.m.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest
littletranspunk@lemmus.org · 4 pts · 2y
It's a competition? Damn, that's wild XD
frontporchtreat@lemmy.ca · 4 pts · 2y
One of the benefits of the haskell style is easy commenting of the additional functions. I do something similar in my python scripts when testing several differnent chunks of code.
But then again I chose a career in GIS so I probably have a mental disorder.
frontporchtreat@lemmy.ca · 1 pts · 2y
Sweetpeaches69@lemmy.world · 1 pts · 1y
As someone who works with, and sometimes on GIS, but not solely on GIS, I can confirm your last sentence. Godspeed.
caseyweederman@lemmy.ca · 14 pts · 2y
I went from not being able to tell the difference to being deeply disturbed by everything in the red
Subverb@lemmy.world · 9 pts · 2y
K&R 4evah
perviouslyiner@lemmy.world · 7 pts · 2y
Perl style: all on one line, with the 'while' statement at the end.
vampire@lemmy.world · 6 pts · 2y
Just run with the default style of the de-facto formatter for whatever language you are using. It's really not worth any mental effort.
GissaMittJobb@lemmy.ml · 6 pts · 2y
This is true, but it also moves the discussion to which is the superior code for matter for languages that don't have a clear default option, and of course to which languages have the best formatters.
I have a hard stance in this question - code formatters should be deterministic on any given syntax tree - there should be no leeway for choosing how any given piece of code formats. Seriously. If your anti-bikeshedding tool does not completely eliminate the bikeshedding, you have not done your job correctly.
PM_ME_VINTAGE_30S@lemmy.sdf.org · 2 pts · 2y
But it's fun to argue over
janAkali@lemmy.one · 6 pts · 2y
Ew. I usually don't use curly braced languages. But whenever I need to define collections on multiple lines I always put opening bracket on the end of the line and closing bracket on the same indent level as the start of the statement:
alyth@lemmy.world · 6 pts · 2y
stackPeek@lemmy.world · 3 pts · 2y
Haven't coded with Lisp, but I've seen Lisp codes that are formatted like that. Haskell too.
cheesorist@lemmy.world · 3 pts · 2y
GNU > Allman
Cerise_W@lemmy.world · 2 pts · 2y
Can we talk about variable scope? Is x changing inside a called function without so much as a pointer being passed?
Deuces@lemmy.world · 6 pts · 2y
Avoiding global variables is just something dumb people do to protect themselves. Real programmers declare every variable before Main.
Spider89@lemmy.world · 2 pts · 2y
I'm Ratliff and K&R style.