ifn't

Serpent7776, I can actually define this in TCL:
<span style="color:#323232;">% proc ifn't {cond cmds} {if {!$cond} {uplevel $cmds}} </span><span style="color:#323232;">% ifn't false {puts </span><span style="color:#0086b3;">12</span><span style="color:#323232;">} </span><span style="color:#323232;">12 </span><span style="color:#323232;">% ifn't true {puts </span><span style="color:#0086b3;">12</span><span style="color:#323232;">} </span><span style="color:#323232;">% </span>
PanArab, (edited ) This can’t be for real. I’ll stick with C11 thank you.
stardreamer, ![]()
Here you dropped this:
<span style="font-weight:bold;color:#a71d5d;">#define </span><span style="font-weight:bold;color:#795da3;">ifnt</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>
janabuggs, I’m struggling to understand if this is true or ifn’t true
Thcdenton,
davidgro, Ding ding ding ding ding ding…
olafurp, I’d take a
not
or “if not” operator tbh.
Appoxo, ![]()
ifnt instead of ifn’t
csm10495, ![]()
Imagine the regex needed to highlight code with that extra single quote.
ohlaph, <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, (edited ) This is the !biggest comp sci innovation in !decades
rimjob_rainer, (edited ) Why not just ifnot? Same count of characters but an o instead of a possibly problematic single quote.
KmlSlmk64, ![]()
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, whileunless
made it clear without needing to write out!= true
.
HexAndSquare, It’s also cool when you do unless(!condition). I particularly like this.
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
muntedcrocodile, (edited ) ![]()
With ahit like that its not microsoft java its now microsoft javascript
ohlaph, That’s Typescript…
lordmauve, Python already has this.
0x0, 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>
yum13241, Now what about GZDoom’s
GoAwayAndDie();
?
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 thet()
function on theifn
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
.
Kissaki, Personally, I like to call catched exception variables
up
, so for a rethrow I canthrow up;
.
Vorthas, ![]()
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, ![]()
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)
OpenStars, ![]()
Mesa, ![]()
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.
luciole, ![]()
I shan’t!
taanegl, I’m just hoping this paves the way to code with Southern dialect
<span style="color:#323232;">iffun is == true </span><span style="color:#323232;">iffun ain't == false </span>
timetravel, May I introduce you to the joys of #define and creating your own horrible sub language
frezik, (edited ) 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.
bappity, (edited ) ![]()
cap () {
}
nocap () {}
runner_g, (edited ) nocap(frfr){
}
Add comment