Trailblazing Braille Taser @lemmy.dbzer0.com I propose a new, more threatening kind of control flow.
do { /* something */ } or else { /* you don't want to find out */ }
210 1 Replygex @lemmy.world Some C++ style guides suggest the following naming convention for functions that crash on any error
OpenFileOrDie()
59 0 Replyxmunk @sh.itjust.works PHP has the always wonderful (and perfectly functional) syntax of
logUserIn() or die();
26 0 ReplyKissaki @programming.dev
Personally, I like to call catched exception variables
up
, so for a rethrow I canthrow up;
.10 0 ReplyVorthas @programming.dev
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.4 0 ReplyMonkderZweite @feddit.ch I mean, it makes sense to call ComplainToErrorAndExit just 'die', no?
4 0 ReplyOpenStars @startrek.website
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)
4 1 Replyyum13241 @lemm.ee Now what about GZDoom's
GoAwayAndDie();
?1 0 Reply
Strawberry @lemmy.blahaj.zone this is just a menacing try/catch!
41 0 Replymoody @lemmings.world It_would_be_a_shame_if(condition)
24 0 ReplyMesa @programming.dev
The better try-catch. More intuitive if you ask me.
10 0 Replyjadelord @discuss.tchncs.de It exists, kind of. Python has this construct
for item in iterable: ... else: ...
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.
8 0 ReplyOpenStars @startrek.website
You just made me a offer I can't refuse. I go now to sleep with the fishes...
8 2 Replyrothaine @beehaw.org do { /* something */ } do hast { /* something */ }
5 0 ReplyTrailblazing Braille Taser @lemmy.dbzer0.com do { /* something */ } do hast { /* something */ } do hast mich { /* something */ }
7 0 Reply
OpenStars @startrek.website
Please God let this be a humorous post that somehow does not also find a way to manage to come true...
107 2 Replyjtk @lemmy.sdf.org 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 keywords with a ' in the name.
89 0 ReplyPup Biru @aussie.zone
i mean, “unless” tends to be the usual term for an “if not” keyword in languages that implement such a thing
45 0 ReplyOpenStars @startrek.website
Yeah, to be clear, I don't like it, I don't like it one bit:-P.
16 2 Reply
Bappity @lemmy.world
cap () {
}
nocap () {}
99 0 Replyrunner_g @lemmy.blahaj.zone nocap(frfr){
}
47 1 Reply
MagicShel @programming.dev Reduce exclamation marks!? Great Scott!!!!! Is there a shortage of punctuation in the future!?
79 1 ReplyKairuByte @lemmy.dbzer0.com
You could have saved two, all you had to do was use the interrobang. You’re a monster.
21 0 ReplySubArcticTundra @lemmy.ml
All known deposits were depleted
15 0 Replyjaybone @lemmy.world 1.21GB!!!
13 0 ReplyRob @lemmy.world Kernighan, what was I thinking?
4 0 Reply
ohlaph @lemmy.world aint (something) { somethingElse() }
53 0 ReplyFacebones @reddthat.com As a Virginian learning coding, this would make my damn day.
6 0 ReplyThreeme2189 @lemm.ee #define aint(x) if (!(x))
11 0 Reply
15liam20 @lemmy.world Or maybe
taint(condition) {}
2 0 Reply
Lung @lemmy.world
ifn't(!valid)
halp?40 0 ReplyDeconceptualist @lemm.ee
I believe that resolves the same as
ain't!(!untrue)
40 0 Reply
rimjob_rainer @discuss.tchncs.de Why not just ifnot? Same count of characters but an o instead of a possibly problematic single quote.
39 0 ReplyOokami38 @sh.itjust.works 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
20 0 ReplyFerk @kbin.social
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'
?17 0 ReplyKmlSlmk64 @lemmy.world
If someone really wanted to add it, probably the best would be to use
unless
15 1 ReplyJoshuaEN @lemmy.world I really liked having
unless
in Ruby; a!
can be easy to miss, whileunless
made it clear without needing to write out!= true
.10 1 Reply
xmunk @sh.itjust.works Still not as good as
whence
37 0 Replyfartsparkles @sh.itjust.works Is this a reference to something because I’d love to read it if you have a time to share.
14 0 Replyxx3rawr @sh.itjust.works Woah. I did a quick google and it's not just a meme, but actually used in some major lang's libraries.
6 0 ReplyLeFrog @discuss.tchncs.de
It is used in
ksh
korn shell to see what executable responds to a command:https://superuser.com/a/351995
Edit: Oh, what a rabbit hole: Why not use "which"? What to use then?
5 0 Reply
SubArcticTundra @lemmy.ml
Legislation (which feels similar to programming languages sometimes) seems to have some keywords of its own. I remember seeing a lot of
Whereas ...
andHaving regard to ...
.2 0 Reply
xia @lemmy.sdf.org "Help's with readability"? You know what else helps? Not using contractions and introducing an unbalanced single quote.
34 2 Replybdonvr @thelemmy.club
If they'd'nt've done that, it'd've been better. Agreed.
45 0 ReplyCwilliams @beehaw.org Aside: rip Tom Scott
3 0 ReplyRob @lemmy.world TIHI
1 0 Reply
frezik @midwest.social Runs havoc on parsing, too. It's bad for both humans and robots. I say we ship it.
4 0 Replysurvivalmachine @beehaw.org This feels racist against Appalachia. We naturally speak with contractions and are commonly referred to as "unbalanced".
3 0 Reply
janabuggs @beehaw.org I'm struggling to understand if this is true or ifn't true
30 1 Replycsm10495 @sh.itjust.works
Imagine the regex needed to highlight code with that extra single quote.
28 0 ReplyCaveman @lemmy.world I'd take a
not
or "if not" operator tbh.26 0 ReplyLmaydev @programming.dev It has a not keyword it's used for pattern matching.
if (x is not null)
9 0 ReplyCaveman @lemmy.world It also has a
!=
.3 0 ReplyPatches @sh.itjust.works Stuff can be two things
2 0 Reply
Appoxo @lemmy.dbzer0.com
ifnt instead of ifn't
3 0 Reply
taanegl @beehaw.org
I'm just hoping this paves the way to code with Southern dialect
iffun is == true iffun ain't == false
24 0 Replytimetravel @lemmings.world May I introduce you to the joys of #define and creating your own horrible sub language
21 0 Replyfrezik @midwest.social That reminds me of an old paper about how to create a compilable C program out of old game ROMs. Decompile to assembly. Implement a bunch of
#define
statements that implement all the ASM statements. Now compile it to a native binary on whatever platform.Won't likely be faster or more accurate than regular emulation methods, but it's a neat idea considering that the source code on all this stuff was lost a long time ago.
6 0 Reply
jtk @lemmy.sdf.org ifn't (myNum don't= 3 && myStr ain'tnull'rblankish)
19 0 Replyfelbane @lemmy.world Please remain calm, we are sending paramedics to your location.
14 0 Replyripcord @lemmy.world
I genuinely lol'd
2 0 Reply
SubArcticTundra @lemmy.ml
I hate seeing colloquial terms like ‘ain't’ in non-comment (ie. standardized) parts of code
7 1 Reply
THCDenton @lemmy.world
19 0 Replydavidgro @lemmy.world Ding ding ding ding ding ding...
1 0 Reply
muntedcrocodile @lemmy.world
With ahit like that its not microsoft java its now microsoft javascript
18 1 Replyohlaph @lemmy.world That's Typescript...
9 0 Reply
AlmightySnoo 🐢🇮🇱🇺🇦 @lemmy.world
reminds me of
#ifndef
instead of#if !defined(...)
13 2 Replyمن البحر إلى النهر @lemmy.world This can't be for real. I'll stick with C11 thank you.
13 2 ReplyStarDreamer @lemmy.blahaj.zone
Here you dropped this:
#define ifnt(x) if (!(x))
27 0 Reply
vlad @lemmy.sdf.org
What's wrong with "else"
11 1 ReplyNekkoDroid @programming.dev
It's not
ifn't
51 0 ReplySpaceNoodle @lemmy.world *it'sn't
20 1 ReplyNocturnalMorning @lemmy.world ^This
OP raises a valid point
2 2 Reply
Darkassassin07 @lemmy.ca
if(condition) {#block never used} else {#actually do a thing}
Vs
ifn't(condition) {#actually do a thing}
Vs
if!(condition) {#actually do a thing}
6 0 Replygandalf_der_12te @feddit.de
vs
if (not condition) {#actually do a thing}
2 2 Reply
MNByChoice @midwest.social Cannot start a statement with else. One can with ifn't. There is a new thing where we don't branch (which is a separate discussion).
Or am I missing the joke...
3 0 Reply
fl42v @lemmy.ml This has to be illegal. I mean, it's basically suicide incitement (or whatever is the phrase for it)
11 1 Replytiredofsametab @kbin.social die unless $keyword == "unless";
9 0 ReplyDieguiTux8623 @feddit.it 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 usetakeIf
with a negated predicate) because my mind forgets the unless version exists.2 0 Replydevfuuu @lemmy.world 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.
2 0 Reply
lordmauve @programming.dev Python already has this.
9 0 Replylurch (he/him) @sh.itjust.works i assume "ifnot" wasn't edgy enough and makes inferior noises on custom mechanical keyboards? /s
10 2 Reply420stalin69 [he/him] @hexbear.net array.whomst(element => element === needle)
4 0 Replyluciole (he/him) @beehaw.org
I shan't!
4 0 ReplyHexbear2 [any] @hexbear.net This is the !biggest comp sci innovation in !decades
3 0 Replymax @lemmy.blahaj.zone ;-;
2 0 ReplySerpent7776 @programming.dev 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} %
2 0 Reply