Please God let this be a humorous post that somehow does not also find a way to manage to come true…
ifn't
Submitted 9 months ago by JPDev@programming.dev to programmer_humor@programming.dev
https://programming.dev/pictrs/image/3cb22526-3cb8-40ee-b012-e7f13b9b57f6.png
Comments
OpenStars@startrek.website 9 months ago
jtk@lemmy.sdf.org 9 months ago
I would have bought it if they said ifnot instead, it’s the same number of characters and wouldn’t require a major parser overhaul to support.
pupbiru@aussie.zone 9 months ago
i mean, “unless” tends to be the usual term for an “if not” keyword in languages that implement such a thing
OpenStars@startrek.website 9 months ago
mryessir@lemmy.sdf.org 9 months ago
(define-syntax ifn't (syntax-rules () ((_ cond) (or cond #t)) ((_ cond false) (ifn't cond false #t)) ((_ cond false else) (if (not cond) false else))))
deadstare
OpenStars@startrek.website 9 months ago
bappity@lemmy.world 9 months ago
cap () {} nocap () {}
runner_g@lemmy.blahaj.zone 9 months ago
No cap(frfr){
}
MagicShel@programming.dev 9 months ago
Reduce exclamation marks!? Great Scott!!! Is there a shortage of punctuation in the future!?
KairuByte@lemmy.dbzer0.com 9 months ago
You could have saved two, all you had to do was use the interrobang. You’re a monster.
SubArcticTundra@lemmy.ml 9 months ago
All known deposits were depleted
jaybone@lemmy.world 9 months ago
1.21GB!!!
fsr1967@lemmy.world 9 months ago
Kernighan, what was I thinking?
the_of_and_a_to@lemmy.world 9 months ago
[deleted]JPDev@programming.dev 9 months ago
unlessn’t
Goun@lemmy.ml 9 months ago
I’m sorry, I hate the “unless” so much
NotSteve_@lemmy.ca 9 months ago
At one of my first jobs, I was tasked to rewrite a bunch of legacy Perl scripts in Python and the unless lines always made me trip up. I don’t know why but it really messed with my mental flow when reading Perl code
chaogomu@kbin.social 9 months ago
Basic used "else".
It's nice. "if", "then", and "else". I spent a year programming a shitty roulette game on an Apple 2e back in high school. I still remember the joy of using if/then/else paired with goto to make a horrible mess of spaghetti logic.
But yeah, "else" is nice.
SubArcticTundra@lemmy.ml 9 months ago
Using a standalone ‘else’ would tickle my brain in the same nice way that being able to declare a variable inside an ‘if’ statement as if it were a ‘for’ loop (witch you can do in modern C++) does.
Deceptichum@kbin.social 9 months ago
Let's just scrap every language except various forms of BASIC.
EnderMB@lemmy.world 9 months ago
I haven’t written any Ruby for years, but I still praise it in every conversation I have regarding programming languages. It’s basically a much simpler Python, with some design ideas that are both beautiful and deeply strange.
OskarAxolotl@lemmy.world 9 months ago
Ruby was designed to evoke joy and they absolutely succeeded. Usually, programming is mostly a means to an end to me. But using Ruby just feels so amazing, it’s almost impossible to even describe to somebody who has never used it before.
marcos@lemmy.world 9 months ago
The Perl version of it is even greater!
ohlaph@lemmy.world 9 months ago
aint (something) { somethingElse() }
Facebones@reddthat.com 9 months ago
As a Virginian learning coding, this would make my damn day.
Threeme2189@lemm.ee 9 months ago
#define aint(x) if (!(x))
15liam20@lemmy.world 9 months ago
Or maybe
taint(condition) {}
lung@lemmy.world 9 months ago
ifn’t(!valid)
halp?xmunk@sh.itjust.works 9 months ago
Still not as good as
whence
fartsparkles@sh.itjust.works 9 months ago
Is this a reference to something because I’d love to read it if you have a time to share.
xx3rawr@sh.itjust.works 9 months ago
Woah. I did a quick google and it’s not just a meme, but actually used in some major lang’s libraries.
LeFrog@discuss.tchncs.de 9 months ago
It is used in
korn
shell to see what executable responds to a command:
SubArcticTundra@lemmy.ml 9 months ago
Legislation (which feels similar to a programming languages sometimes) seems to have some keywords of its own. I remember seeing a lot of
Whereas …
andHaving regard to …
.
rimjob_rainer@discuss.tchncs.de 9 months ago
Why not just ifnot?
Ookami38@sh.itjust.works 9 months ago
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
Ferk@kbin.social 9 months ago
yes... how is reducing exclamation marks a good thing but adding a
'
(not to be confused with\``,
‘or
’`)KmlSlmk64@lemmy.world 9 months ago
If someone really wanted to add it, probably the best would be to use
unless
JoshuaEN@lemmy.world 9 months ago
I really liked having
unless
in Ruby; a!
can be easy to miss, whileunless
made it clear without needing to write out!= true
.
xia@lemmy.sdf.org 9 months ago
“Help’s with readability”? You know what else helps? Not using contractions and introducing an unbalanced single quote.
bdonvr@thelemmy.club 9 months ago
If they’d’nt’ve done that, it’d’ve been better. Agreed.
Cwilliams@beehaw.org 9 months ago
Aside: rip Tom Scott
fsr1967@lemmy.world 9 months ago
TIHI
frezik@midwest.social 9 months ago
Runs havoc on parsing, too. It’s bad for both humans and robots. I say we ship it.
survivalmachine@beehaw.org 9 months ago
This feels racist against Appalachia. We naturally speak with contractions and are commonly referred to as “unbalanced”.
janabuggs@beehaw.org 9 months ago
I’m struggling to understand if this is true or ifn’t true
csm10495@sh.itjust.works 9 months ago
Imagine the regex needed to highlight code with that extra single quote.
olafurp@lemmy.world 9 months ago
I’d take a
not
or “if not” operator tbh.Lmaydev@programming.dev 9 months ago
It has a not keyword t’s used for pattern matching.
if (x is not null)
Patches@sh.itjust.works 9 months ago
Stuff can be two things
taanegl@beehaw.org 9 months ago
I’m just hoping this paves the way to code with Southern dialect
iffun is == true iffun ain't == false
jtk@lemmy.sdf.org 9 months ago
ifn't (myNum don't= 3 && myStr ain'tnull)
Thcdenton@lemmy.world 9 months ago
muntedcrocodile@lemmy.world 9 months ago
Its not microsoft java its now microsoft javascript
PanArab@lemmy.world 9 months ago
This can’t be for real. I’ll stick with C11 than you.
AlmightySnoo@lemmy.world 9 months ago
reminds me of
#ifndef
fl42v@lemmy.ml 9 months ago
That has to be illegal. I mean, it’s basically suicide incitement (or whatever is the phrase for it)
vlad76@lemmy.sdf.org 9 months ago
What’s wrong with “else”
lurch@sh.itjust.works 9 months ago
i assume “ifnot” wasn’t edgy enough and makes inferior noises on custom mechanical keyboards? /s
lordmauve@programming.dev 9 months ago
Python already has this.
tiredofsametab@kbin.social 9 months ago
die unless $keyword == "unless";
420stalin69@hexbear.net 9 months ago
array.whomst(element => element === needle)
luciole@beehaw.org 9 months ago
I shan’t!
Hexbear2@hexbear.net 9 months ago
This is the biggest comp sci innovation in !decades
max@lemmy.blahaj.zone 9 months ago
;-;
Serpent7776@programming.dev 9 months ago
I can actually define this in TCL:
% proc ifn't {cond cmds} {if {!$cond} {uplevel $cmds}} % ifn't false {puts 12} 12 % ifn't true {puts 12} %
0x0@lemmy.dbzer0.com 9 months ago
I propose a new, more threatening kind of control flow.
gex@lemmy.world 9 months ago
Some C++ style guides suggest the following naming convention for functions that crash on any error
OpenFileOrDie()
xmunk@sh.itjust.works 9 months ago
PHP has the always wonderful (and perfectly functional) syntax of
logUserIn() or die();
Kissaki@programming.dev 9 months ago
Personally, I like to call catched exception variables
up
, so for a rethrow I canthrow up;
.OpenStars@startrek.website 9 months ago
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)
Vorthas@programming.dev 9 months ago
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.MonkderZweite@feddit.ch 9 months ago
I mean, it makes sense to call ComplainToErrorAndExit just ‘die’, no?
Strawberry@lemmy.blahaj.zone 9 months ago
this is just a menacing try/catch!
moody@lemmings.world 9 months ago
It_would_be_a_shame_if(condition)
Mesa@programming.dev 9 months ago
The better try-catch. More intuitive if you ask me.
OpenStars@startrek.website 9 months ago
You just made me a offer I can’t refuse. I go now to sleep with the fishes…
jadelord@discuss.tchncs.de 9 months ago
It exists, kind of. Python has this construct
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.
rothaine@beehaw.org 9 months ago
0x0@lemmy.dbzer0.com 9 months ago