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

Re: another take on hackers and painters



At 11:05 PM -0500 5/21/03, Robby Findler wrote:
>At Wed, 21 May 2003 18:02:13 -0400, Dan Sugalski wrote:
>>  >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...
>
>What gave it away? :)

Well, the sarcasm dripping from the message was a clue... (Apparently 
puddled sarcasm leaves stains on carpeting. Who knew? :)

>(FWIW, Icon's conversions seem not anywhere near
>as horrible as the others that have gone by on the list recently)

Neither are perl's, which are the same as Icon's, though it also will 
quietly (or not so quietly, if you've asked it to yell) convert 
non-numbers to zero.

>Still, the point is larger than auto-conversion. Auto-conversions are
>one way to remove potential error checking from a program;

No, no it isn't.

You've not removed the potential for error checking, at all. You've 
removed the potential for some static error checking, but that makes 
no difference, really, since there's no way to catch at compile time 
that the user fed in "foo" instead of a number. The vast majority of 
autoconverted data comes from outside sources, at runtime. 
Autoconverting languages will catch a type error when the automatic 
conversion is done, non-autoconverting languages will catch it when 
they try and explicitly turn the string to a number, which generally 
will happen at the same spot.  Either way, with or without 
autoconversion, there will be a translation, and likely a *runtime* 
exception thrown on error. The only difference is that there's more 
code in the non-autoconverting language, and thus more chance of 
error.

Now, if you wanted to argue that silent conversion with no chance of 
throwing an error is a problem, well, I'd not disagree. On the other 
hand, being able to silently ignore errors and translate to zero is 
quite handy when throwing together quick and dirty programs. I've 
generally found it much easier to convince autoconverting languages 
to complain than I have to convince non-autoconverting languages to 
autoconvert.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk