Python from Wise Guy's Viewpoint

Pascal Costanza costanza at
Sun Oct 26 23:21:51 CET 2003

Ed Avis wrote:

> - Hmm, I wonder if I might make an analogy between type checking and
> syntax checking.  In the language Tcl almost everything, including
> code, is a string, and the 'if' statement is just something that takes
> three strings and evaluates the first, followed by either the second
> or third.  The syntax of these strings is not checked at compile time.
> You can write code like
>     if $cond { puts "hello" ( } else { puts "goodbye" }
> and the syntax error in the 'hello' branch won't be found unless you
> run a test case setting $cond true.
> The question is, can a static syntax checking system make exactly the
> same conclusions at compile time, and predict all and only the syntax
> errors that Tcl would report at run time?
> The answer is no.
> 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.


More information about the Python-list mailing list