Python from Wise Guy's Viewpoint

Ed Avis ed at membled.com
Mon Oct 27 14:03:29 CET 2003


Pascal Costanza <costanza at web.de> writes:

>>Should we then conclude that compile-time syntax checking is not
>>worth having?
>
>No. Syntax errors make the program fail, regardless whether this is
>checked at compile-time or at runtime.
>
>A type "error" detected at compile-time doesn't imply that the
>program will fail.

Actually it does, in a statically typed language.  If you write a
function which expects a Boolean and you pass it a string instead,
it's going to fail one way or another.

OK, the bad call of that function might never be reachable in actual
execution, but equally the syntax error in Tcl code might not be
reached.  I'd rather find out about both kinds of mistake sooner
rather than later.

(I do mean a type error and not a type 'error' - obviously if you have
some mechanism to catch exceptions caused by passing the wrong type,
you wouldn't want this to be checked at compile time.)

-- 
Ed Avis <ed at membled.com>




More information about the Python-list mailing list