ON ERROR RESUME NEXT
-
For some reason, that just popped into my head.......I wasn't even looking at anything code related, was watching the "Couch Commander" video :laugh: Anyway, the question is are there any other "statements" such as the one in the subject' in any other programming language that so eloquently and succinctly tell you exactly what it's doing.......? The more obscure the language the better. And if anyone says this is a programming question, which it is, but it's not, will get a skelped dock!
Dave Find Me On:Web|Youtube|Facebook|Twitter|LinkedIn Folding Stats: Team CodeProject
Bloody hell, nobody mentioned GOTO or even GOSUB. It may not be error handling bit it was/is almost as abused as RESUME NEXT. There were some doozies in the Lotus 123 macro language as well but I can't remember them. And did you ever look under the hood of early Lotus Notes, now there was a whole collection of nightmares!
Never underestimate the power of human stupidity RAH
-
For some reason, that just popped into my head.......I wasn't even looking at anything code related, was watching the "Couch Commander" video :laugh: Anyway, the question is are there any other "statements" such as the one in the subject' in any other programming language that so eloquently and succinctly tell you exactly what it's doing.......? The more obscure the language the better. And if anyone says this is a programming question, which it is, but it's not, will get a skelped dock!
Dave Find Me On:Web|Youtube|Facebook|Twitter|LinkedIn Folding Stats: Team CodeProject
I actually used the MUMPS language when I did a contract for the VA. No reserved word, since everything was by context: This was actually legal MUMPS code, since all things could be shortened to the first letter: GREPTHIS() N S,N,T,I,K,Q S I="K",S="11",K="l1",Q="R",T="K" I I=T D T Q:$Q Q Q T I I,S&K S S=S+K Q The full blown statements weren't much better: GREPTHIS() NEW SET,NEW,THEN,IF,KILL,QUIT SET IF="KILL",SET="11",KILL="l1",QUIT="RETURN",THEN="KILL" IF IF=THEN DO THEN QUIT:$QUIT QUIT QUIT ; (quit) THEN IF IF,SET&KILL SET SET=SET+KILL QUIT Just to put history behind it, MUMPS was the "Massachusetts General Hospital Utility Multi-Programming System", and (colloquially) was designed by doctors.
-
PLEASE NO!! Don't ever utter tha line ever agian, make it forgotten from the whole world. The damages and catastrophes caused by that line are uncountable!
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
Like
catch (Exception) {}
? I pretty much like my catches, so I'll keep using those thank you :) If I couldn't use lines of code, functions, or libraries whose usage has made me cringe in the past I should really find another job. I've seen things :sigh:Read my (free) ebook Object-Oriented Programming in C# Succinctly. Visit my blog at Sander's bits - Writing the code you need. Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
Like
catch (Exception) {}
? I pretty much like my catches, so I'll keep using those thank you :) If I couldn't use lines of code, functions, or libraries whose usage has made me cringe in the past I should really find another job. I've seen things :sigh:Read my (free) ebook Object-Oriented Programming in C# Succinctly. Visit my blog at Sander's bits - Writing the code you need. Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
It dones't mean they don't have to be used - I use this one too (Yes, I still work with VB6) - but it would be way better to forget them at all. The problems caused by those lines after years they have been developed... basically unfindable bugs because the sucker acts like there is no problem at all. Add this to the fact that the runtimes throws exceptions like candies instead of returning a status value and you have to manage exceptions for perfectly reasonable beahviours, like opening a non existing file. It can happen, it's usually no big deRUNTIME ERROR! CLOSE THE HATCHES! PREPARE FOR IMMERSION NOW!!! So many times you simply stick to On Error Resume Next and then problems arise, after years of seemingly fine running. It's like having a bazooka for home defence. Effective it is, useful also, but it's farking dangerous.
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
-
It dones't mean they don't have to be used - I use this one too (Yes, I still work with VB6) - but it would be way better to forget them at all. The problems caused by those lines after years they have been developed... basically unfindable bugs because the sucker acts like there is no problem at all. Add this to the fact that the runtimes throws exceptions like candies instead of returning a status value and you have to manage exceptions for perfectly reasonable beahviours, like opening a non existing file. It can happen, it's usually no big deRUNTIME ERROR! CLOSE THE HATCHES! PREPARE FOR IMMERSION NOW!!! So many times you simply stick to On Error Resume Next and then problems arise, after years of seemingly fine running. It's like having a bazooka for home defence. Effective it is, useful also, but it's farking dangerous.
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
Most TrySomething (like TryParse) methods swallow exceptions if you don't check for the return value. The if-statement can be just as harmful. Take those huge nested if-else branches. Impossible to test, impossible to change (without breaking everything). So we replace the if-statements with switch/case-statements, same thing happens. We need to loop through some collection, but it's kind of recursive, and now some programmer uses foreach foreach foreach... (yeah, I've seen it happen). In SQL Server when an exception occurs it's more or less swallowed UNLESS you use try-catch (how many programmers know that?). So I now shouldn't use catch, TryParse, if, switch/case, foreach, and SQL Server :) Well, I agree ON ERROR RESUME NEXT is the most useless of them all :)
Read my (free) ebook Object-Oriented Programming in C# Succinctly. Visit my blog at Sander's bits - Writing the code you need. Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
Most TrySomething (like TryParse) methods swallow exceptions if you don't check for the return value. The if-statement can be just as harmful. Take those huge nested if-else branches. Impossible to test, impossible to change (without breaking everything). So we replace the if-statements with switch/case-statements, same thing happens. We need to loop through some collection, but it's kind of recursive, and now some programmer uses foreach foreach foreach... (yeah, I've seen it happen). In SQL Server when an exception occurs it's more or less swallowed UNLESS you use try-catch (how many programmers know that?). So I now shouldn't use catch, TryParse, if, switch/case, foreach, and SQL Server :) Well, I agree ON ERROR RESUME NEXT is the most useless of them all :)
Read my (free) ebook Object-Oriented Programming in C# Succinctly. Visit my blog at Sander's bits - Writing the code you need. Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
You're absolutely right about the huge nested ifs, I usually tend to modularize a lot and where multiple checks are involved I use a SEQUENCE of if and a cumulative status, so that it becomes
bool keep_going = true;
if (error_cond1) keep_going = false;
if (keep_going && error_cond2) keep_going = false;
...It's easier to read and modify, also it's not mandatory to have a single cumulative status. Since I work with stdcalls, VB6 and plain old C code on old compilers (long story short: we can't change.) I can't reliably use exceptions outside the deepest functions and being the VS6 stdlib what it is I don't really need them since it's better to stick to CRT functions, which don't have exceptions. Being VS6 CRT what it is many "safe" functions that use SEH exceptions do not exist so I don't use them either.
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
-
For some reason, that just popped into my head.......I wasn't even looking at anything code related, was watching the "Couch Commander" video :laugh: Anyway, the question is are there any other "statements" such as the one in the subject' in any other programming language that so eloquently and succinctly tell you exactly what it's doing.......? The more obscure the language the better. And if anyone says this is a programming question, which it is, but it's not, will get a skelped dock!
Dave Find Me On:Web|Youtube|Facebook|Twitter|LinkedIn Folding Stats: Team CodeProject
I'd say the If..Then..Else statement is pretty clear, amongst many many others. If anything, your example is a little odd, as it really doesn't tell you what it is doing - resume next what? That's not English. (It's also an extremely dodgy technique of error handling, equivalent of enclosing every statement in:
Exception error;
try {
statement;
}
catch (Exception ex) {
error = ex;
}Which just invites people not to bother checking the result. May as well have a statement like
On Error Keep Calm and Carry On
"If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.
-
For some reason, that just popped into my head.......I wasn't even looking at anything code related, was watching the "Couch Commander" video :laugh: Anyway, the question is are there any other "statements" such as the one in the subject' in any other programming language that so eloquently and succinctly tell you exactly what it's doing.......? The more obscure the language the better. And if anyone says this is a programming question, which it is, but it's not, will get a skelped dock!
Dave Find Me On:Web|Youtube|Facebook|Twitter|LinkedIn Folding Stats: Team CodeProject
-
I still love plain old C#.
foreach(var exception in MyExceptionCollection)
try
throw exception;
catch()
continue;The best bit about PERL (in fact the only good bit) is On Error DIE Is that why PERL programmers are becoming scarce? We're philosophical about power outages here. A.C. come, A.C. go.
-
For some reason, that just popped into my head.......I wasn't even looking at anything code related, was watching the "Couch Commander" video :laugh: Anyway, the question is are there any other "statements" such as the one in the subject' in any other programming language that so eloquently and succinctly tell you exactly what it's doing.......? The more obscure the language the better. And if anyone says this is a programming question, which it is, but it's not, will get a skelped dock!
Dave Find Me On:Web|Youtube|Facebook|Twitter|LinkedIn Folding Stats: Team CodeProject
When I worked at CompuServe, a coworker wrote some code I was running a test harness on for connecting to the portal. His variable "IBHosed" showed up in the exception if the connection wasn't established.
-
catch { // TODO: }
-
MOVE 50 TO discountPercentage
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
You're absolutely right about the huge nested ifs, I usually tend to modularize a lot and where multiple checks are involved I use a SEQUENCE of if and a cumulative status, so that it becomes
bool keep_going = true;
if (error_cond1) keep_going = false;
if (keep_going && error_cond2) keep_going = false;
...It's easier to read and modify, also it's not mandatory to have a single cumulative status. Since I work with stdcalls, VB6 and plain old C code on old compilers (long story short: we can't change.) I can't reliably use exceptions outside the deepest functions and being the VS6 stdlib what it is I don't really need them since it's better to stick to CRT functions, which don't have exceptions. Being VS6 CRT what it is many "safe" functions that use SEH exceptions do not exist so I don't use them either.
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++* Weapons extension: ma- k++ F+2 X If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver When I was six, there were no ones and zeroes - only zeroes. And not all of them worked. -- Ravi Bhavnani
I think you could also put in a "goto" instead of setting "keep_going" if you want to break up that nested if architecture. :cool::suss: ;P :laugh:
-
Like
catch (Exception) {}
? I pretty much like my catches, so I'll keep using those thank you :) If I couldn't use lines of code, functions, or libraries whose usage has made me cringe in the past I should really find another job. I've seen things :sigh:Read my (free) ebook Object-Oriented Programming in C# Succinctly. Visit my blog at Sander's bits - Writing the code you need. Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
-
catch { // TODO: }
-
Most TrySomething (like TryParse) methods swallow exceptions if you don't check for the return value. The if-statement can be just as harmful. Take those huge nested if-else branches. Impossible to test, impossible to change (without breaking everything). So we replace the if-statements with switch/case-statements, same thing happens. We need to loop through some collection, but it's kind of recursive, and now some programmer uses foreach foreach foreach... (yeah, I've seen it happen). In SQL Server when an exception occurs it's more or less swallowed UNLESS you use try-catch (how many programmers know that?). So I now shouldn't use catch, TryParse, if, switch/case, foreach, and SQL Server :) Well, I agree ON ERROR RESUME NEXT is the most useless of them all :)
Read my (free) ebook Object-Oriented Programming in C# Succinctly. Visit my blog at Sander's bits - Writing the code you need. Or read my articles here on CodeProject.
Simplicity is prerequisite for reliability. — Edsger W. Dijkstra
Regards, Sander
If your code is something like this try { statement } catch () {} try { statement } catch () {} ... Then the ON ERROR RESUME NEXT statement makes sense. I actually use it on occasion where I have a short procedure and I want the errors to be consumed and don't care what they are. Doesn't happen often but it does every now and then.
-
For some reason, that just popped into my head.......I wasn't even looking at anything code related, was watching the "Couch Commander" video :laugh: Anyway, the question is are there any other "statements" such as the one in the subject' in any other programming language that so eloquently and succinctly tell you exactly what it's doing.......? The more obscure the language the better. And if anyone says this is a programming question, which it is, but it's not, will get a skelped dock!
Dave Find Me On:Web|Youtube|Facebook|Twitter|LinkedIn Folding Stats: Team CodeProject
RANDOMIZE TIMER