Python from Wise Guy's Viewpoint

Paul F. Dietz dietz at dls.net
Fri Oct 24 04:34:25 EDT 2003


Ralph Becket wrote:

> Here's the way I see it:
> (1) type errors are extremely common;
> (2) an expressive, statically checked type system (ESCTS) will identify 
>   almost all of these errors at compile time;
> (3) type errors flagged by a compiler for an ESCTS can pinpoint the source
>   of the problem whereas ad hoc assertions in code will only identify a
>   symptom of a type error;
> (4) the programmer does not have to litter type assertions in a program
>   written in a language with an ESCTS;
> (5) an ESCTS provides optimization opportunities that would otherwise
>   be unavailable to the compiler;
> (6) there will be cases where the ESCTS requires one to code around a
>   constraint that is hard/impossible to express in the ESCTS (the more
>   expressive the type system, the smaller the set of such cases will be.)

However,

(7) Developing reliable software also requires extensive testing to
   detect bugs other than type errors, and
(8) These tests will usually detect most of the bugs that static
   type checking would have detected.

So the *marginal* benefit of static type checking is reduced, unless you
weren't otherwise planning to test your code very well.

BTW, is (3) really justified?  My (admittedly old) experience with ML
was that type errors can be rather hard to track back to their sources.

	Paul





More information about the Python-list mailing list