Python from Wise Guy's Viewpoint

Adrian Hey ahey at NoSpicedHam.iee.org
Thu Oct 23 10:37:19 EDT 2003


Pascal Costanza wrote:

> Fergus Henderson wrote:
> 
>> In my experience, people who have difficulties in getting their programs
>> to typecheck usually have an inconsistent design, not a design which is
>> consistent but which the type checker is too restrictive to support.
> 
> Have you made sure that this is not a circular argument?

It is obviously not a circular argument.

> Does "consistent design" mean "acceptable by a type checker" in your book?

Fergus was refering to programs that simply would not work, even if the
compiler ignored the type errors and generated code anyway. Obviously
not all type inconsistent programs fall into this category (only about
99.999..% of them:-). I've been using statically typed FPL's for a 
good few years now, and I can only think of one occasion where I had
"good" code rejected by the type checker (and even then the work around
was trivial). All other occasions it was telling me my programs were
broken (and where they were broken), without me having to test it.

This is good thing.  

As for dynamics, I don't think anybody would deny the usefulness of a
dynamic type system as a *supplement to* the static type system. (As
you have observed, there are occasions when type checking just can't
be done at compile time). But no way is a dynamic type system an
adequate *substitute for* modern static type systems. Most code
can be (and should be IMO) checked for type errors at compile time.

Regards
--
Adrian Hey 





More information about the Python-list mailing list