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

Re: another take on hackers and painters

On Wed, 21 May 2003, Dan Sugalski wrote:

> At 3:52 PM -0500 5/21/03, Robby Findler wrote:
> [snip]
> >In fact, lets get rid of all errors in programs. Up with the DWIM
> >instruction! Down with reliability!
> I'm going to take a wild guess here that you're not a big fan of
> autoconversion...

This is kinda the crux of the argument, though I don't see any explicit
statement of it: the danger of the 3 + "12" feature isn't in the
expression 3 + "12", it's in the expression 3 + "oops!". If 3 + "oops!"
raises an exception, or dies, or takes some other action that will force
the program to either deal with it or stop right there, there's no
problem. You've just written convenient syntax for a perfectly reasonable
function when dealing with small-scale parsers.

If, on the other hand, it silently evaluates to something that won't
indicate any error (say, 3) you've introduced an insidious bug into the
programs of anybody who uses the feature. Most of the time, the program
will work fine, all your tests will pass, you'll be happy and you'll
ship it. But if anyone anywhere manages to get a non-number string into a
place where you expected a number-string, you'll get a program that
merrily does the wrong thing until eventually either some later
instruction crashes the program or the program finishes normally. If that
happens, you'll spend all day tracking down an error that could've been
headed off in 10 seconds.