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.

ohlaph , in ifn't

<span style="color:#323232;">aint (something) {
</span><span style="color:#323232;">    somethingElse()
</span><span style="color:#323232;">}
</span>
Facebones ,

As a Virginian learning coding, this would make my damn day.

Threeme2189 ,

<span style="font-weight:bold;color:#a71d5d;">#define </span><span style="font-weight:bold;color:#795da3;">aint</span><span style="color:#323232;">(x) </span><span style="font-weight:bold;color:#a71d5d;">if </span><span style="color:#323232;">(</span><span style="font-weight:bold;color:#a71d5d;">!</span><span style="color:#323232;">(x))
</span>
15liam20 ,

Or maybe

taint(condition) {}

Hexbear2 , in ifn't

This is the biggest comp sci innovation in !decades

420stalin69 , in ifn't

array.whomst(element => element === needle)

rimjob_rainer , in ifn't

Why not just ifnot? Same count of characters but an o instead of a possibly problematic single quote.

KmlSlmk64 ,
@KmlSlmk64@lemmy.world avatar

If someone really wanted to add it, probably the best would be to use unless

JoshuaEN ,

I really liked having unless in Ruby; a ! can be easy to miss, while unless made it clear without needing to write out != true.

HexAndSquare ,

It’s also cool when you do unless(!condition). I particularly like this.

Ferk , (edited )
@Ferk@kbin.social avatar

Yes... how is "reducing exclamation marks" a good thing when you do it by adding a ' (not to be confused with , ´,or’` ..which are all different characters).

Does this rely on the assumption that everyone uses a US QWERTY keyboard where ! happens to be slightly more inconvenient than typing '?

Ookami38 ,

I think it’s just capitalizing on a trend to add n’t to otherwise noy contractions, to make them into contractions. Contractionn’ts, if you will

emly_sh_ , in WDYM your terminal isn't a test suite?
@emly_sh_@sh.itjust.works avatar

Can someone explain, I don’t get it.

ripcord ,
@ripcord@lemmy.world avatar

If you clear your history, you feel like a SpongeBob popsicle for some reason? That’s what I’m reading. Gotta be it.

sabreW4K3 OP ,
@sabreW4K3@lemmy.tf avatar

Clean and shiny! Brand spanking new!

emly_sh_ ,
@emly_sh_@sh.itjust.works avatar

Weird, I clear my history very frequently and never once felt like a SpongeBob popsicle.

ripcord ,
@ripcord@lemmy.world avatar

Same, but I just assumed I was the weird one. Maybe we are mainstream!

emly_sh_ ,
@emly_sh_@sh.itjust.works avatar

Cool! Do you also have a function that wipes the history file when exiting the terminal?

Luvon , in Sometimes things do go your way

The bug is in the library of a library that the library owns. They fixed it and published it in the library of the library but the library hasn’t been updated in 2 months.

muntedcrocodile , in ifn't
@muntedcrocodile@lemmy.world avatar

With ahit like that its not microsoft java its now microsoft javascript

ohlaph ,

That’s Typescript…

Michal , in Sometimes things do go your way

And the library update isn’t published for 6 months

fckreddit , in Sometimes things do go your way

And then you wake up.

cornshark , in DO NOT MERGE

Heh, a funny collision of terms.

The green Merged means that the pull request was submitted into the branch.

The DO NOT MERGE text is an instruction for automerger. Android is developed in a truly startling amount of related git branches. Automerger is the tool that propagates commits back and forth to make sure pull requests get to all flavours, versions and devices.

DO NOT MERGE tells Automerger not to propagate that pull request to newer versions of Android, i.e. it’s a fix for the currently released version that’s not relevant to the next development version of Android for whatever reason.

Also seen, although more rarely, is DO NOT MERGE ANYWHERE which tells Automerger not to propagate the pull request to any other branch other than where it was originally submitted, including branches for related products on the same version of Android.

leds OP ,

Interesting, thanks for explaining. Like someone else was saying it is already in AOSP not introduced in lineage which makes sense since it is just a cherrypick

CodeMonkey ,

Out of curiosity, any idea what automerger they use? I have always been on the lookout for one for hobby projects.

superfes , in Sometimes things do go your way

This has happened to me once, in 20 years of development.

That’s pretty good.

lordmauve , in ifn't

Python already has this.

tiredofsametab , in ifn't

die unless $keyword == "unless";

DieguiTux8623 ,

I personally have a gut feeling of rejection for every language having the unless keyword. This is why I hardly know any PERL and Ruby for example.

I have mixed feelings towards Kotlin’s takeUnless scope function (I nearly always use takeIf with a negated predicate) because my mind forgets the unless version exists.

devfuuu ,

For me I don’t know if it’s because I’m not english native, but reading and understanding code using unless or similar negated boolean operators makes my mind stop computing amd becomes very hard to read.

0x0 , in ifn't

I propose a new, more threatening kind of control flow.


<span style="color:#323232;">do {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">} or else {
</span><span style="color:#323232;">  /* you don't want to find out */
</span><span style="color:#323232;">}
</span>
Strawberry ,

this is just a menacing try/catch!

gex ,

Some C++ style guides suggest the following naming convention for functions that crash on any error


<span style="color:#323232;">OpenFileOrDie()
</span>
xmunk ,

PHP has the always wonderful (and perfectly functional) syntax of

logUserIn() or die();

msage ,

Or Perl

evatronic ,

Where do you think PHP stole it from?

msage ,

Bash?

frezik , (edited )

Perl also has unless() for the very purpose in OP, which is a more sensible choice.

Oh, and if you need to reinforce your belief that Perl is a mess, the single-quote character can be used as a package separator instead of “::”. This was set in the 90s when nobody was quite sure of the right syntax for package separators, so it borrowed “::” from C++ and the single quote from Ada (I think).

That means the ifn’t() in OP can be interpreted as calling the t() function on the ifn package.

The “::” separator is vastly preferred, though. Single quotes run havoc on syntax highlighting text editors (since they can also be used for strings). About the only time I’ve seen it used is a joke module, Acme::don’t.

MonkderZweite ,

I mean, it makes sense to call ComplainToErrorAndExit just ‘die’, no?

Kissaki ,

Personally, I like to call catched exception variables up, so for a rethrow I can throw up;.

TwilightKiddy ,

Except rethrowing an exception in C# is just throw;, anything else is a crime against the person who reads your stacktraces.

Vorthas ,
@Vorthas@programming.dev avatar

One of the modules in a project I’m working on is called VulkanOrDie which always makes me crack up when I see it in the compilation messages.

OpenStars ,
@OpenStars@startrek.website avatar

It’s funnier when you try to SysCallAndDie() :-P

(that’s a real thing in perl btw - I guess that function didn’t get the memo)

yum13241 ,

Now what about GZDoom’s GoAwayAndDie();?

OpenStars ,
@OpenStars@startrek.website avatar

You just made me a offer I can’t refuse. I go now to sleep with the fishes…

Mesa ,
@Mesa@programming.dev avatar

The better try-catch. More intuitive if you ask me.

moody ,

It_would_be_a_shame_if(condition)

rothaine ,

<span style="color:#323232;">do {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">} do hast {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">}
</span>
0x0 ,

<span style="color:#323232;">do {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">} do hast {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">} do hast mich {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">}
</span>
jadelord ,

It exists, kind of. Python has this construct


<span style="color:#323232;">for item in iterable:
</span><span style="color:#323232;">    ...
</span><span style="color:#323232;">else:
</span><span style="color:#323232;">     ...
</span>

which always puzzles me, since it depends on a break statement execution. I always have to look it up when the else block is executed.

sneaky_hecker , in DO NOT MERGE
@sneaky_hecker@lemmy.world avatar

Even if it was merged I’d be more concerned how on earth you have infinite Firefox tabs open

lone_faerie ,

It’s when you have more than 99 tabs open

DreadPotato ,
@DreadPotato@sopuli.xyz avatar

What kind of psychopath has that many tabs open!?

CrypticCoffee ,

I take personal offense to that. How do you not?

Kusimulkku ,

I close all the tabs regularly. Bookmark for those that I need to save for longer than one session

DreadPotato , (edited )
@DreadPotato@sopuli.xyz avatar

I bookmark stuff I need at a later time, or will need again, and read the stuff I want to read now and close the tab when I’m done.

Daeraxa ,

I got to that once, on mobile I’ve never worked out the rule for when FF opens a new tab vs opening a site in your current tab. They just kind of silently accumulate.

DreadPotato ,
@DreadPotato@sopuli.xyz avatar

Yeah it’s a bit weird with FF, I just purge open tabs for unnecessary tabs daily.

loutr ,
@loutr@sh.itjust.works avatar

There’s a setting to auto-close tabs after a certain amount of time.

DreadPotato ,
@DreadPotato@sopuli.xyz avatar

I like to be in control of what gets closed and when, so nothing gets closed before I bookmark it if need it.

mexicancartel ,

“Oh no! What if I need it later”

~ me, more than 99 times

leds OP ,

Yeah that’s the problem I have, started while ago. It opens a new tab instead switching to existing tab.

poplargrove ,

I keep tabs open as a sort of “read page later” list. I never seem to get to reading them though.

DreadPotato ,
@DreadPotato@sopuli.xyz avatar

So do I, for a few days. If I haven’t read it by then, I’ll either bookmark for later or just close. I pretty much never have more than 10-15 active tabs ever.

ripcord ,
@ripcord@lemmy.world avatar

As we know, scientists have not yet discovered any numbers past 99

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