Python from Wise Guy's Viewpoint

Joe Marshall jrm at ccs.neu.edu
Wed Oct 29 13:15:20 EST 2003


Pascal Costanza <costanza at web.de> writes:

> No, for christ's sake!  There are dynamically typed programs that you
> cannot translate into statically typed ones!

You are really going to confuse the static typers here.  Certainly
there is no program expressable in a dynamically typed language such
as Lisp that is not also expressible in a statically typed language
such as SML.

But it *is* the case that there are programs for which safe execution
*must* depend upon checks (type checks or pattern matching) that are
performed at run time.  Static analysis will not remove the need for
these.

It is *also* the case that there are programs for which safe execution
requires *no* runtime checking, yet static analysis cannot prove that
this is the case.

A static analyzer that neither inserts the necessary run-time checks,
nor requires the user to do so will either fail to compile some correct
programs, or fail to correctly compile some programs.

I think the static typers will be agree (but probably not be happy
with) this statement:  There exist programs that may dynamically admit
a correct solution for which static analyzers are unable to prove that
a correct solution exists.




More information about the Python-list mailing list