lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sam Roberts wrote (actually, Chris Cummer):
	in VBScript programming for web pages you can add "On Error Resume
	Next" which will continue to execute the code whether an error exists
	or not
	
	i hate that line of code more than any other i've ever come
	across, for the record

	the use of that line indicates your code is so bad even error
	handling can't manage it. two years at <deleted> hunting down that
	line of code, removing it, and then fixing everything it masked

I believe this command, coming from Visual Basic, and IIRC even from older Basics, was primarily created for IO (or such uses): if you want to open a non-existing file, VB stops the run-time and show a dialog reporting the problem. Most of the time, you don't want that and prefer to manage the error (like asking nicely the user to indicate another file or use a fallback file, etc.).

Sam Roberts wrote:
> YOU would never abuse your scripts like this, of course, you would fix
> the errors immediately... but maybe you will have to debug code by
> others that are not so responsible?

Exactly...
It reminds me of an anecdote I saw in an old programming book: a scientist wrote a program to analyze data. It failed because the bounds of an array was too small. Instead of analyzing why he reached the bounds of his previous estimate (perhaps the algorithm has a flaw), he just increased the bounds until it worked... And his results was published in official scientific magazines...

Newbies error: don't find why there is a problem, just workaround (or ignore) it... "Gee, I am sure my code is good, this computer is just stupid, I will teach it to behave!". :-)

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --