There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

nexussapphire , in Brace Style

Last day at the company, pushed over 5,000 commits. Just style changes, still passes all the checks.

KairuByte ,
@KairuByte@lemmy.dbzer0.com avatar

This would never pass PR review.

el_abuelo ,

Jokes on you, we don’t have PR review.

nexussapphire ,

Do your code reviewers subscribe to the didn’t check looks good model? Joking btw.

KairuByte ,
@KairuByte@lemmy.dbzer0.com avatar

Dear god

el_abuelo ,

He can’t hear you all the way down here.

dejected_warp_core ,

This is fine.

Binette , in Brace Style

Pseudo-python

MadMadBunny , in Brace Style

WE CAN DO THAT!?!??

Skullgrid ,
@Skullgrid@lemmy.world avatar

… whitespace is whitespace.

Revan343 , in Brace Style

I kinda like it, easy to see unbalanced braces

victorz , in Brace Style

;}}}

MTK , in Brace Style

Honestly, looks neat, might adopt this

Sanctus , in Brace Style
@Sanctus@lemmy.world avatar
the_tab_key ,

I forgot Moses was in Tron

user1234 , in When your shower uses GitHub more than you

Looks like it just needs to be defragged.

TunaCowboy , (edited ) in Brace Style

What if I prefer this?


<span style="color:#323232;">#define CURLYOPENRIGHTCLOSEDLEFTBRACKET {
</span><span style="color:#323232;">#define CURLYOPENLEFTCLOSEDRIGHTBRACKET }
</span><span style="color:#323232;">#define CURVYOPENRIGHTCLOSEDLEFTBRACKET (
</span><span style="color:#323232;">#define CURVYOPENLEFTCLOSEDRIGHTBRACKET )
</span><span style="color:#323232;">#define PERIODWITHPERIODONTOP :
</span><span style="color:#323232;">#define COMMAWITHPERIODONTOP ;
</span><span style="color:#323232;">
</span><span style="color:#323232;">int main CURVYOPENRIGHTCLOSEDLEFTBRACKET CURVYOPENLEFTCLOSEDRIGHTBRACKET CURLYOPENRIGHTCLOSEDLEFTBRACKET
</span><span style="color:#323232;">  if CURVYOPENRIGHTCLOSEDLEFTBRACKET 1 CURVYOPENLEFTCLOSEDRIGHTBRACKET CURLYOPENRIGHTCLOSEDLEFTBRACKET
</span><span style="color:#323232;">    asm volatile CURVYOPENRIGHTCLOSEDLEFTBRACKET
</span><span style="color:#323232;">      "mov $1, %%raxn"
</span><span style="color:#323232;">      "mov $1, %%rdin"
</span><span style="color:#323232;">      "lea message(%%rip), %%rsin"
</span><span style="color:#323232;">      "mov $4, %%edxn"
</span><span style="color:#323232;">      "syscalln"
</span><span style="color:#323232;">      PERIODWITHPERIODONTOP
</span><span style="color:#323232;">      PERIODWITHPERIODONTOP
</span><span style="color:#323232;">      PERIODWITHPERIODONTOP "%rax", "%rdi", "%rsi", "%rdx"
</span><span style="color:#323232;">    CURVYOPENLEFTCLOSEDRIGHTBRACKET COMMAWITHPERIODONTOP
</span><span style="color:#323232;">  CURLYOPENLEFTCLOSEDRIGHTBRACKET
</span><span style="color:#323232;">  return 0 COMMAWITHPERIODONTOP
</span><span style="color:#323232;">CURLYOPENLEFTCLOSEDRIGHTBRACKET
</span><span style="color:#323232;">
</span><span style="color:#323232;">asm CURVYOPENRIGHTCLOSEDLEFTBRACKET ".section .datan"
</span><span style="color:#323232;">  "message: .ascii "wut\n"n"
</span><span style="color:#323232;">  ".section .textn" CURVYOPENLEFTCLOSEDRIGHTBRACKET COMMAWITHPERIODONTOP
</span>
humbletightband ,

You can’t be helped, sorry. We will put you to an asylum for people like you

milicent_bystandr ,

Asylum? We have the electric chair for this.

humbletightband ,

Yeah, now I see why you want him dead. He used mov after lea

uis ,

Pack him, boys: youtu.be/hHuLZFuugTQ

MajorHavoc ,

Thanks. I hate it.

z500 ,
@z500@startrek.website avatar

You win a free trip to the Hague

SkyezOpen ,

They don’t even deserve the trial. Straight to gulag.

uis ,

Still need at least troyka to send to gulag. Or regular court outside of stalinism.

lud ,

The taxi chauffeur can be judge and do it on the way to the gulag.

Obviously the sentence is predetermined.

dariusj18 ,

Can this be done with emoji?

brbposting ,

😫

xmunk ,

Acceptable, just FYI I added a pre-commit git hook, please rebase your changes.

magic_lobster_party , (edited ) in Brace Style

I’m more concerned about that poor stack with all those recursions.

It’s also O(n^2) O(n!). I’m not sure what they’re trying to do, but I’m sure it can be done in O(n) (or at least polynomial).

Reject.

Fillicia , in Brace Style
user224 , (edited )
@user224@lemmy.sdf.org avatar

Mmmm, perfectly level.

gofsckyourself ,

It’s just YAML…

Fillicia ,

YAML makes you appreciate Python’s 4 spaces indentation.

victorz ,

I thought python allowed whatever indentation you wanted as long as it’s consistent?

zalgotext ,

It does, but most style guides and autoformatters will use 4

HK65 ,

Python is one of the few languages with an official style guide, I think that guide says 4 spaces.

northendtrooper ,

Tabs!

nexussapphire ,

I’ve set tabs to four spaces in vim because who the fuck defaults tab to eight spaces. That shit looks alien and pushes text off the screen fast.

ulterno ,
@ulterno@lemmy.kde.social avatar

I set my clang-format to tabs only (actual tabs ASCII 0x9, no alignment and there is a continuation tab instead), then anyone can set their editor to whatever tab length they feel like and look at their code however they want.

But no spaces on the left of my code. This is for C, C++ and JSON.

oscar ,

Linux uses 8 spaces. Excerpt from the official style guide:

Tabs are 8 characters, and thus indentations are also 8 characters. There are heretic movements that try to make indentations 4 (or even 2!) characters deep, and that is akin to trying to define the value of PI to be 3.

Rationale: The whole idea behind indentation is to clearly define where a block of control starts and ends. Especially when you’ve been looking at your screen for 20 straight hours, you’ll find it a lot easier to see how the indentation works if you have large indentations.

Now, some people will claim that having 8-character indentations makes the code move too far to the right, and makes it hard to read on a 80-character terminal screen. The answer to that is that if you need more than 3 levels of indentation, you’re screwed anyway, and should fix your program.

In short, 8-char indents make things easier to read, and have the added benefit of warning you when you’re nesting your functions too deep. Heed that warning.

The reasoning seems sound, but I still prefer 4 personally.

nexussapphire ,

I don’t develop kernel modules, I use python. That’s pretty interesting though.

sukhmel ,

4 tabs is a bit overboard, don’t you think?

Fillicia ,

pep8 calls for 4 space but it is a guidance not a rule.

Google internal style guide recommend(ed?) 2 spaces to accomodate the line length limit.

Simulation6 ,

4 spaces? Hard core Python programmers must have a callus on their thumbs.

BeardedGingerWonder ,

Just assign tab to 4 spaces.

mariusafa ,

Literally me every time I want to program something slightly complex in Python.

Kojichan ,
@Kojichan@lemmy.world avatar

I’d love to see your .editorconfig.

What’s that in your project root? …pom.xml? Misread that at first as porn.xml.

Fillicia ,

I’m not the OG on this, just an old reddit post I remembered

old.reddit.com/r/ProgrammerHumor/…/writing_yaml/

0ops ,

porn.xml

If I had a nickel every time I read it like that

bitwolf ,

But yaml forces the indentation

some_guy , in Brace Style

What the fuck!

angelmountain , in Brace Style

How happy I am with prettier. This is just a thing in an ancient past for me now.

Username ,

Recently tried biome for a web project. It’s a combined linter and formatter, and it’s so good. Compatible with prettier too.

key ,

Are you referring to autoformat like most linters and IDEs can do or does prettier have some special transpilation capability to hide braces?

GissaMittJobb , in Brace Style

Automatically enforced deterministic formatting is the best, there’s nothing that beats it. The productivity in just being able to format on save knowing that the code will be in the ideally formatted state, along with the anti-bikeshedding properties of this strategy, makes it unbeatable.

h0bbl3s ,
@h0bbl3s@lemmy.world avatar

gofumpt and gofmt are the best. One of the reasons if I have a choice I’ll code in go. I heard rumblings that rust was working towards having rustfmt be a standard crate.

GissaMittJobb ,

Go is in a good position, yeah. JavaScript has prettier, which is nice. Java has google-java-format. Python has ruff, which is quite good. Kotlin has ktfmt, which I believe made a mistake with their standards by not following the standard formatting guidelines for the language, but whatever. Uniform and deterministic for the win.

Username ,

What do you mean? rustfmt is the de facto standard and is easily run using cargo fmt. Most projects use it along with clippy, the standard linter.

h0bbl3s ,
@h0bbl3s@lemmy.world avatar

I had no idea it was standard. I had heard they had issues with it not being able to handle certain constructs so they were working on getting it to a place it would perform better. Has this changed? I’m not a rust person, but I intend to be. I’ve barely made it 1/4th way into the book (just started in the past month and I’ve been busy), but I have a good background in programming and so far it’s been super easy. I’m really enjoying how specific the compiler is, and the binary sizes vs Go.

thenextguy , in When your shower uses GitHub more than you

My shower doesn’t use me at all.

Schorsch ,

That’s not what it feels like to your shower though.

thenextguy ,

I wanna spread the news
That if it feels this good getting used
Oh you just keep on using me
Until you use me up

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines