this is just a menacing try/catch!
Comment on ifn't
0x0@lemmy.dbzer0.com 10 months ago
I propose a new, more threatening kind of control flow.
do { /* something */ } or else { /* you don't want to find out */ }
Strawberry@lemmy.blahaj.zone 10 months ago
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
jadelord@discuss.tchncs.de 9 months ago
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.
rothaine@beehaw.org 9 months ago
do { /* something */ } do hast { /* something */ }
0x0@lemmy.dbzer0.com 9 months ago
do { /* something */ } do hast { /* something */ } do hast mich { /* something */ }
gex@lemmy.world 10 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();
msage@programming.dev 9 months ago
Or Perl
frezik@midwest.social 9 months ago
Perl also has
unless()
for the very purpose in OP, which is a more sensible choice.evatronic@lemm.ee 9 months ago
Where do you think PHP stole it from?
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?