I propose a new, more threatening kind of control flow.
do {
/* something */
} or else {
/* you don't want to find out */
}
Some C++ style guides suggest the following naming convention for functions that crash on any error
OpenFileOrDie()
PHP has the always wonderful (and perfectly functional) syntax of
logUserIn() or die();
Or Perl
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.
Where do you think PHP stole it from?
Bash?
Personally, I like to call catched exception variables up, so for a rethrow I can throw up;.
Except rethrowing an exception in C# is just throw;, anything else is a crime against the person who reads your stacktraces.
I mean, it makes sense to call ComplainToErrorAndExit just 'die', no?
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.
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)
Now what about GZDoom's GoAwayAndDie();?
this is just a menacing try/catch!
It_would_be_a_shame_if(condition)
The better try-catch. More intuitive if you ask me.
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.
You just made me a offer I can't refuse. I go now to sleep with the fishes...
do {
/* something */
} do hast {
/* something */
}
do {
/* something */
} do hast {
/* something */
} do hast mich {
/* something */
}
Please God let this be a humorous post that somehow does not also find a way to manage to come true...
Why not just ifnot? Same count of characters but an o instead of a possibly problematic single quote.
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
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 '?
If someone really wanted to add it, probably the best would be to use unless
I really liked having unless in Ruby; a ! can be easy to miss, while unless made it clear without needing to write out != true.
It's also cool when you do unless(!condition). I particularly like this.
Still not as good as whence
Is this a reference to something because Iโd love to read it if you have a time to share.
Woah. I did a quick google and it's not just a meme, but actually used in some major lang's libraries.
This is one of those "modern Google/search sucks" moments because I couldn't immediately find examples of it in a programming language.
I actually used DDG and most I've seen, they're just used as arguments for functions notably in C and Python
It is used in ksh korn shell to see what executable responds to a command:
Legislation (which feels similar to programming languages sometimes) seems to have some keywords of its own. I remember seeing a lot of Whereas ... and Having regard to ....
"Help's with readability"? You know what else helps? Not using contractions and introducing an unbalanced single quote.
If they'd'nt've done that, it'd've been better. Agreed.
Runs havoc on parsing, too. It's bad for both humans and robots. I say we ship it.
This feels racist against Appalachia. We naturally speak with contractions and are commonly referred to as "unbalanced".
I'm struggling to understand if this is true or ifn't true
Imagine the regex needed to highlight code with that extra single quote.
I'm just hoping this paves the way to code with Southern dialect
iffun is == true
iffun ain't == false
May I introduce you to the joys of #define and creating your own horrible sub language
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.
I'd take a not or "if not" operator tbh.
It has a not keyword it's used for pattern matching.
if (x is not null)
It also has a !=.
Pattern matching is different.
Yeah, I just said it since you used it with null. I used it a lot for enums
The type matching is the most common thing I use it with. Combined with inline variables.
if (x is string { Length: 5} s)
{
// do stuff with s
}
I propose a new, more threatening kind of control flow.
Some C++ style guides suggest the following naming convention for functions that crash on any error
PHP has the always wonderful (and perfectly functional) syntax of
logUserIn() or die();
Or Perl
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
.Where do you think PHP stole it from?
Bash?
Personally, I like to call catched exception variables
up
, so for a rethrow I canthrow up;
.Except rethrowing an exception in C# is just
throw;
, anything else is a crime against the person who reads your stacktraces.I mean, it makes sense to call ComplainToErrorAndExit just 'die', no?
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.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)
Now what about GZDoom's
GoAwayAndDie();
?this is just a menacing try/catch!
It_would_be_a_shame_if(condition)
The better try-catch. More intuitive if you ask me.
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.
You just made me a offer I can't refuse. I go now to sleep with the fishes...
Please God let this be a humorous post that somehow does not also find a way to manage to come true...
cap () {
}
nocap () {
}
nocap(frfr){
}
Reduce exclamation marks!? Great Scott!!!!! Is there a shortage of punctuation in the future!?
You could have saved two, all you had to do was use the interrobang. Youโre a monster.
All known deposits were depleted
1.21GB!!!
Kernighan, what was I thinking?
As a Virginian learning coding, this would make my damn day.
Or maybe
taint(condition) {}
ifn't(!valid)
halp?I believe that resolves the same as
Why not just ifnot? Same count of characters but an o instead of a possibly problematic single quote.
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
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'
?If someone really wanted to add it, probably the best would be to use
unless
I really liked having
unless
in Ruby; a!
can be easy to miss, whileunless
made it clear without needing to write out!= true
.It's also cool when you do unless(!condition). I particularly like this.
Still not as good as
whence
Is this a reference to something because Iโd love to read it if you have a time to share.
Woah. I did a quick google and it's not just a meme, but actually used in some major lang's libraries.
This is one of those "modern Google/search sucks" moments because I couldn't immediately find examples of it in a programming language.
I actually used DDG and most I've seen, they're just used as arguments for functions notably in C and Python
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?
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 ...
."Help's with readability"? You know what else helps? Not using contractions and introducing an unbalanced single quote.
If they'd'nt've done that, it'd've been better. Agreed.
they'd'nt've
Aside: rip Tom Scott
TIHI
Runs havoc on parsing, too. It's bad for both humans and robots. I say we ship it.
This feels racist against Appalachia. We naturally speak with contractions and are commonly referred to as "unbalanced".
I'm struggling to understand if this is true or ifn't true
Imagine the regex needed to highlight code with that extra single quote.
I'm just hoping this paves the way to code with Southern dialect
May I introduce you to the joys of #define and creating your own horrible sub language
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.
I'd take a
not
or "if not" operator tbh.It has a not keyword it's used for pattern matching.
It also has a
!=
.Pattern matching is different.
Yeah, I just said it since you used it with null. I used it a lot for enums
The type matching is the most common thing I use it with. Combined with inline variables.
And switch expressions.
As a side note inline variables are amazing haha
ifnt instead of ifn't
With ahit like that its not microsoft java its now microsoft javascript
That's Typescript...
Ding ding ding ding ding ding...
reminds me of
#ifndef
instead of#if !defined(...)
This has to be illegal. I mean, it's basically suicide incitement (or whatever is the phrase for it)
What's wrong with "else"
It's not
ifn't
*it'sn't
I'dn't've said it like that.
Perchance
^This
OP raises a valid point
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}
vs
if (not condition) {#actually do a thing}
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...
This can't be for real. I'll stick with C11 thank you.
Here you dropped this:
die unless $keyword == "unless";
Python already has this.
i assume "ifnot" wasn't edgy enough and makes inferior noises on custom mechanical keyboards? /s
I shan't!
This is the !biggest comp sci innovation in !decades
array.whomst(element => element === needle)
;-;
I can actually define this in TCL: