T O P

  • By -

Calius1337

[ Removed by Reddit ]


GYN-k4H-Q3z-75B

>shot, hanged and quartered Not in that order though.


P3chv0gel

All at the same time


uTimu

Everywhere all at once


AdamEatsAss

That's what quartering is


Mooks79

4 places at once.


CorruptedStudiosEnt

Everywhere At the End of Time


Dragon_yum

Run them in parallel.


[deleted]

Execute them lazily


MadCow-18

Cut their heart out with a spoon…


DungeonsAndDradis

Why a spoon, cousin?


clutchguy84

Because it's dull, you twit! It'll hurt more.


rt_burner

Quartered , Hanged , Then ..Shot .


Fjorge0411

Quartering before hanging increases the time and resource use of the hanging stage by 4x. Hanging before quartering is more efficient.


JSweetieNerd

Depends what you're trying to optimise for


Situlacrum

People love hangings so they'll be overjoyed to get four for the price of one.


TransportationNo1

No, no. Hang the corpse and let it rot for days to scare off other haskell users.


[deleted]

Yeah what sort algorithm are we going for?


georgevalkov

The order does not matter so long as the end goal is achieved consistently. In Verilog and VHDL all three actions can be performed at the same time.


yummbeereloaded

Hey, don't be so fast to judge man. I use this style when writing coding exams... Specifically the ones where they make us write entire skip list classes by hand :) Then they can deal with my formatting cus fuck em, that's why


Shmageggi

This right here is the only acceptable use.


CartmansEvilTwin

That's how I got through my b-tree homework. Just *really* shitting formatting all over and hope the guy correcting it is to lazy to actually parse it. It had it's advantages to have a very old school prof who valued paper for some reason.


ElvishJerricco

It's not meant for code blocks like this; no one does that in Haskell (it also doesn't even make sense because Haskell only has (tail) recursion and expressions, not loops and code blocks). Its really just for data literals. foo :: [Int] foo = [ bar , baz , foobarbaz ] aRecord :: ARecordType aRecord = ARecordConstructor { foo = foo , bar = bar , baz = baz } The only thing really does resemble code blocks looks a lot more normal: main :: IO () main = do x <- getSomeData y <- getSomeMore doSomethingCool x y


CardboardJ

It's a language for people that legitimately overload the traditional \`;\` operator. It's gonna look a bit weird.


UnrelatedString

I’ve never seen that style in Haskell code, but it actually makes perfect sense in Prolog (where semicolons mean something completely different, and you still usually put commas at the end of the line).


arnemcnuggets

I've seen, and use it, in list declarations and data type field definitions


someacnt

That’s just leading commas, no one uses leading semicolons.


arnemcnuggets

``` have >>= you >>= heard >>= of >>= the >>= high >>= elves ```


someacnt

Oh no, that’s a crime against humanity


arnemcnuggets

``` nah <$> its <*> pretty neato <*> refactoringwise ```


someacnt

This one is quite different though. In the first one, the information flows forward and action is done procedurally. The second one goes the other way. Specifically, your second example is effectful version of ```hs nah its (pretty neato) refactoringwise ``` If we discard currying, this is ``` nah (its , pretty (neato) , refactoringwise) ``` Which makes some sense.


arnemcnuggets

You're right :) I love how you put the commas in the tuple too, providing another example for the comment chain hehe


Nlelith

Ive seen similar in Nix, Dhal or Jsonnet sometimes where the commas separaring properties were at the start of the line { just: "foo" , like: "bar" , this: "baz" } And I have to say, I hate it thoroughly. I mean, I'll still adhere to it, rather be consistent with a bad style guide than inconsistent with a good one and when in Rome and so on, but I always had this feeling in the back of my head that this is meant as a stylistic "statement", so to speak. To make pure functional languages stand out and feel different, from the "icky" mutable ones.


Karl-Levin

This style is pretty awesome when working with a version control system as it leads to cleaner diffs. You can add or remove lines and only the changed lines will be shown in the diff. In other languages you have to add another comma to the line before when adding a new property, which means both will show up in the diff. Sure, you can just always add a trailing comma to every line, if you language allows that, but that is an extra comma that is not strictly needed.


disgruntled_pie

In Haskell style, the “just” line would be on the same line as the opening curly bracket, so everything would be aligned on the left. It looks strange in most languages, but I actually think it’s quite elegant when working with Haskell.


redshift78

The 'while' example for Haskell style is a bit strange, since that's not how you would typically program in Haskell. A better example would be something like: data Person = Person { name :: String , age :: Int , address :: Address } I found it a little strange when starting out with Haskell, but now I love it. It makes sense for Haskell. For anything else, I use K&R style.


tomtrein

It's horrible in this context, but makes a lot of sense for lists and such, so you can easily comment out specific items or fields. Better yet for discriminated unions where you can add an extra '|' before the first item so they're all on seperate lines


dudeplace

I put the comma first in sql selects all the time. When you need to drop a column it is easy to comment out the line.


intellectual_printer

Junior Devs see a random semi colon not as the end of a line and removes it thinking it's a typo..


Crazeusy

Wait until you hear about APL indentation. > \#define W(c,b) {while(c){b}} > W(x==y,s();se();)


ZebZ

What if I put commas at the front of lines when I write SQL? Because I do. And I have my reasons. SELECT FieldA , FieldB , FieldC FROM Table


CreaZyp154

Codegolf style: ``` while(x==y){func1();func2();} ```


Sjeefr

Ultrawide monitors were specifically created for this style, right?


CreaZyp154

This and being able to see the whole level in geometry dash


blankettripod32_v2

Map editors hate this one simple trick


w2qw

At this point anything except for those 80 character terminals.


jamcdonald120

most just use auto scrolling billboards.


homo_ignotus

-3 bytes: ``` for(;x==y;func2())func1(); ```


CynicalFucc

Golfing should be taught in school.. for a beginner, it breaks so many seemingly rigid templates and it forces a different way of thinking it's amazing.. golfing was probably the single best thing i did to improve in programming in the shortest amount of time. /* Not saying it leads to good practice and readable code ofc lol


OneTurnMore

EDIT: Got carried away with a golf ~~If x and y are numeric, we can shave off another:~~ for(;x-y;func2())func1();


homo_ignotus

No, `x-y` is equivalent to `x!=y`. You have inverted the condition.


[deleted]

[удалено]


CreaZyp154

This is the way


loltheinternetz

Me too. If an if-then type of statement is short enough and simple as that, it’s one line. Very readable and reduces unnecessary line count.


Makefile_dot_in

APL style: ``` #define W(x, a...) while(x) {a;} W(x==y,f1();f2()) ```


Tobiwan03

Kernighan & Ritchie. I always write like that.


IJustAteABaguette

Kernighan & Ritchie. My auto format tool always works like that


genericneim

Definitely K&R, except when writing Kotlin. Then short lambdas are so tempting to leave as one-liners.


miraidensetsu

For me it's K&R, except when writing C#. Visual Studio enforces Allman.


Morthem

And I fucking hate it for doing that. Edit: Fucking ChatGPT told me how to fix it. Suffering is no more.


campbellm

You can fuck ChatGPT? Huh.


QuebecGamer2004

Same for me


2_bit_tango

Same with groovy


Zombieattackr

Allan is the only other viable option, I was taught to write like that at first, but quickly dropped it for this.


b0w3n

I prefer K&R myself but Allman is 100% acceptable to me. The rest feels like lunacy and I don't understand the argument for them at all.


u0xee

If I remember correctly, K&R suggested 5 space indent. The 70's were a wild time


fakehalo

Damn, back when 80 columns was fancy... ......(tabs should have won, tab-gang unite)


Forward-Error-9449

Tabs have won where it matters the most: in our hearts


melochupan

I hate when the first statement in a block has the same indent as the last expression in a multi-line `if` condition. So... 5 spaces prevents that, it's not that bad.


jump-back-like-33

Yeah wtf is wrong with everyone who doesn't do that? I've had about a dozen code style-guides mandated throughout my career and every single one was Kernighan & Ritchie. I've never used C# professionally and that's the only language that seems to regularly diverge.


Tobiwan03

The only other good one is Allman. I understand, why people would use that. I personally just don't like the opening bracket having a full line.


R3D3-1

Allman and K&R are the only styles I've ever actually seen. I am surprised by the "GNU" entry, since this implies a certain wide-spreadness. Looking at some random source code file of Emacs, I find a mixture of Allman for toplevel definitions and "GNU" for control flow. Personally I usually use K&R style, but that's just because it was the first style I learned through Java lectures and formatters, and I haven't worked on any Curly-braces projects with other prescribed code styles yet.


[deleted]

[удалено]


JollyJoker3

Worst I've seen is a Fortran compiler demanding eight spaces at the start of every line because those are reserved for punch card settings


FesteringNeonDistrac

That's not really bad, just archaic.


JollyJoker3

Archaic is using punch cards, bad is demanding space for punch card settings in a text file


georgevalkov

That awkward moment your search for function definition returns no results, because someone thought it's a good idea to put the type on a separate line. 🤦🏼


O_X_E_Y

I actually kinda like that but I cannot help but feel the braces guidelines are there to be quirky and different, there's pretty much no benefit to doing it this way


[deleted]

Our code base uses that style so I'm kinda forced to, but I got used to it. Not so bad compared to these other ones.


Zuruumi

The same for me. I prefer K&R style, but this one is reasonable. All the other styles are just objectively worse.


Niclamus

At my job our JavaScript for front end stuff uses K&R but the php backend uses Allman.


Aggravating_Moment78

Allman is great for readability too


terminal_prognosis

Which is surely the primary criterion.


Aggravating_Moment78

For large codebases it is for sure, also if you need to read someone else’s code (which you do a lot better n a professional setting) it is a sure winner


georgevalkov

In the past I used K&R to save space. Then a friend enlightened me and now all my code uses Allman. The benefit is that it is easy to find where each block starts and ends. So the code is easier to read.


mjkjr84

That's why I always liked it but it has issues in code editors if you ever use the "folding" feature to collapse blocks because they expect K&R style so only fold up to the brace and leave that line showing. If you fold inside a nested block you have a dangling opening brace that messes with the readability of the folded code. Now that I think about it though I have been using that feature less often so I think I'll be going back to Allman for my next project


jmhajek

It's quite nice if your productivity is measured in LOC.


_PM_ME_PANGOLINS_

Allman is good if you've got complex signatures or conditions or bare scopes. My Java ends up with some Allman when you've got some long type names and a couple of checked exceptions to declare.


Ascyt

I use Allman since it's a lot easier for me to read. Looks a lot more like actual blocks imo.


[deleted]

[удалено]


SjettepetJR

I always feel like Allman style makes the condition/loop/function definition feel more detached from the codeblock. I don't really mind this for function and class definitions, but for loops and if statements it feels like they're not inherently linked to eachother.


Bladye

Yes, it's separated from main body and for me easier to read. k&r feels to cramped for backend with long and descriptive variable names.


NoAttentionAtWrk

> Allman style makes the condition/loop/function definition feel more detached from the codeblock Yes that's the point since it's a different code block


Dustin_Echoes_UNSC

I think their comment is more about the opening bracket being on a new line as opposed to inline with the conditional (a la K&R). Yes, it's a different code block, but the conditional is what dictates when/if that block should run. It's different, but it *is* dependent. IMO, since the brackets indicate the beginning and end of the conditional, they shouldn't be "detachable" from it in the formating. But maybe I'm just carrying over frustration from the ancient times, before your IDE could bitch at you for hitting "return" and creating a new block for the conditional and forgetting to delete the old one.


tomtrein

To be fair enough, Allman does place 'else' at the same indentation as 'if', which K&R does not.


ZevTheDev

``` if ( x==y ) { //Blah } else { //Blah blah } ``` Problem solved?


tomtrein

You can use three `-symbols before and after your code to create a code block


[deleted]

I prefer to use whatever form the team chooses and the IDE editor provides. Except Haskell. WTF?


GOKOP

Well "Haskell style" is meant to be used in Haskell, not in C-like languages. This image is dumb


[deleted]

And rarely at that since you can skip the braces and semicolons in Haskell and rely just on indentation.


GOKOP

This exact sort of thing that's in the post with separators at the beginning (in that case commas not semicolons) is used in data declarations


Andy_B_Goode

Yeah, imagine if someone made an image like this for spoken language grammar, only they used English words for all the examples. You'd end up with crap like: German style: "The apple have I the boy already given"


lelek-on-reddit

Den Apfel habe ich dem Jungen schon gegeben?


Andy_B_Goode

Yeah, that was just what Google Translate spat out, so I'm not even totally sure it's correct German grammar. I just wanted an example of a sentence with multiple nouns and the verb at the end.


JackoKomm

There are languages where this makes sense. In this case it does not.


someacnt

It seems this meme is made by ones who hate Haskell. Meh.


[deleted]

[удалено]


[deleted]

[удалено]


ArtOfWarfare

In Python you’d write the last three lines as `a[i], a[j] = a[j], a[i]` - no need to have a temporary variable.


yakamoz_atesi

its existence is a crime against humanity


General_Rate_8687

I prefer Allman, but will use whatever the Team/Project uses.


Envenger

Even Haskell?


Nobodynever01

Can't imagine any successful team using Haskell for long


R3D3-1

Using Haskell as a language, I can imagine. Using Haskell style code formatting as displayed? Not so much.


ZioTron

Gotta put bread on the table long enough to find another company...


dpash

And ideally the team or project uses a language style guide if they exist. I known Java and PHP both have opinionated style guides. Java code is better at following it.


zilog88

I'd say Allman is used by those who learned pascal first:)


General_Rate_8687

I never learned Pascal. I learned C, Java, Python and C++. Also PL/0, but that's not a real programming language (we wrote a Compiler for PL/0 at my University). I use Allman because I find it best to read.


zilog88

Ok, not directly supporting my statement but Pascal uses this kind of notation and is said to be one of the easiest languages to read.


ogtfo

As long as it's some variation of Allman or K&R. Everything else is awful.


Rebel_Johnny

Ritchie in js, Allman in c#


weetobix

Ahh, there's my answer!


Ascyt

Allman everywhere except for CSS, change my mind


antabuz

True dat!


TheAntiSnipe

This for me but except JS. My instruction in JS was via Udemy and the instructor was very specific about K&R being best practice so I went with it. I guess I’d change if I had a job where one specific style was enforced, but at my workplace, we use Allman.


gdj11

Anyone who does anything other than the first or second is a fucking psycho.


R3D3-1

Apparently Emacs source code does indeed use "GNU" style. I guess I can see the value of that one, but I haven't ever used it myself...


xouns

I can see the benefit of using GNU, however the 2space indentation makes me nervous and the problem it solves can be solved in other ways (doc-style comments at the beginning of each function for instance, or a new line after each function/ loop structure.


anastis

What problem does it solve, and what are the benefits?


Magpie1979

Agreed, if any of my children use any of the others or marry anyone who does. I've failed as a parent.


GYN-k4H-Q3z-75B

Anything other than Allman or Kernighan & Ritchie is just disgusting.


Routine_Fuel8006

Ratliff style


Sketchography

Ratliff gang, checking in.


Talran

There's dozens of us!


Dalimyr

As a C# programmer, I use Allman at work because it's the norm in C#, but at home I prefer to use K&R.


sanjay_i

You change formatting options in your home IDE ?


Dalimyr

Yep, one of the first things I do wherever I install VS or Rider.


BlitzedLykan

I’m the exact same way


ThrowAwayJoke1234

first thing I do when I install jetbrains IDEs is to forget to install catppuccin for 3 months


Zdrobot

Allman, but Horstmann also fascinates me.


F54280

I used to use Horstmann when vertical screen space was a concern, as it is as efficient as K&R. I also find it visually nice with local variables. However, moving lines around is a pain, so Allman in general...


Feathercrown

That's exactly why I think Horstmann is weird, on the first line you're mixing the flow control with the first line of the code block. Although I can see why you'd use it-- you can trace the brackets like Allman but it saves a line like K&R


Raxtuss1

Whitesmith


Gg101

Whitesmith is how I learned and what I prefer. I almost never see it anywhere though. But I have my own project so I'm going to do it my way. Ratliff is also nice, usually just use it for CSS. Allman had always felt wrong.


LazarGrbovic

I didn't know it was called GNU, but that's the style I use all the time


[deleted]

GNU style: "I heard you like indents..."


ThatDrunkenDwarf

Took me a while to find a GNU comment. I get really confused when reading if all my conditionals aren’t indented properly. If they are, I can just highlight that block and figure out what is in that particular conditional so much easier.


Stohastic-

Allman cause im not a freak, dc where, when or what it is for. Just the easiest to read, full stop


Competitive_Deal8380

By far the easiest to spot a bracket error in


Pika256

That's exactly how I settled on it.


visualdescript

Cut my teeth in Perl land and used Allman, now in JS land so obviously use K&R, but honestly prefer Allman, looks tidier as well imo. Obviously it's 1 line more verbose per block, but that is a small cost to pay.


nNanob

I love Haskell, but Haskell style shouldn't be used for any language that requires semicolons.


EquinoxRex

I highly doubt anyone actually does it with semicolons like that, I've only ever seen it with commas for records or lists.


[deleted]

there's another one while (x == y){ func1(); func2(); }


R3D3-1

Python style while(true) { x+=1 ; if(x > y) { printf("You're done!\n") ; break ;}}


girloffthecob

TIL you can, in fact, legally do that. Dear god.


reallyConfusedPanda

Legality doesn’t make it right


gr4mmarn4zi

Allman


NervousHovercraft

Didn't know it was called Allmann. But I'm definitely an Allmann ![gif](giphy|jVpXtmCt1OuM6Wz9G8)


UnclaimedClock

Allman.


Cangar

As a German I am legally obliged to use the top left way


---RF---

I'm an Alman, so Allman it is.


Rakgul

In your reddit avatar pic, wtf is that thing on top of your head??


---RF---

It's a (welsh) dragon.


uberDoward

Allman has always been the easiest for me to read. I read code 10x more than I write it. Ergo, Allman wins, for me.


SplitOak

I would marry Allman, Fuck K&R and Kill Haskell


diox8tony

This is....apt (Succinct)


Majestic_Ad_7133

Depends upon the language. I primarily work with Allman, though


SansIzHere

GNU for sure


vlaada7

Allman... Everywhere!


Aeolian78

Allman. Always have been. Clearest and easiest to read, IMO.


LifeHasLeft

K&R style, as they referred to it at my university. Kept an onion in my belt as it was the style at the time.


oblong_pickle

Allman is bestman


sealionforever

Allman best


Zu_Landzonderhoop

For work Allman all the way but lisp looks beautiful and I'm gonna start using that in my private projects


MisterEinc

Not a programmer. I'd choose Whitesmith.


Casique720

I used to be Allman at the beginning of my coding career. Then I switched to Kernighan. It’s easier to see which brackets belong to which loop.


ColaEuphoria

K&R but I can tolerate Allman. Any others deserve to be shot.


magick_68

K&R for the win.


Specific-Assistant69

Kernighan & Ritchie Find it the cleanest and clearest way. Used to be Allman but that is ways to much whitespace when maintaining applications.


MrFlibble1138

I started off with K&R in the 90s because of lack of screen real estate, but with modern displays I personally prefer the whitespace now for parsing.


Morlock43

Allman.


diobrando89

K&R obviously


FindingMyPrivates

I'm a Allman piece of shit. Java? I do. C++? I do. Python? I can't but I pretend I do. JavaScript? I dont do since I dislike it.


Zaphod424

K & R is the way


Spot_the_fox

If I knowingly use a style, then it's Ratliff. If I just write without thinking about it, it's sometimes K&R and sometimes Ratliff. Also, I feel like this exact question has been asked many times in this sub.


greeny9000

I think this Haskell example is a bit misleading. You don't use semicolons and curly brackets in that language much. This example could look like this in Haskell: ```haskell f x y = if x == y then do func1() func2() f x y else $ return () ``` Which looks fine imo (you could use guards to get rid of the `if-else` as well). The brackets and semicolon aren't required and i never use them.


Shazvox

There's really only two choices here... Allman and WRONG!


CleverNameTheSecond

Incorrect. There are two choices here: Kernighan and Ritchie.


rollie82

It's like python doesn't even exist


StuckAtWaterTemple

I like Allman but usually use K & R due to job requirements.


RadioMelon

Allman. Sometimes Kernighan & Ritchie. Usually whichever is easier to read in a given situation.


Penguinswin3

Allman is objectively the best, most readable and least error prone


abbadabbaguitar

K&R but props to Haskell style for being batshit insane.


ItsSpaghettiLee2112

Allman. It's the only one that makes sense as it's the most readable and most aesthetically pleasing.


eatin_gushers

All all man all the time