[Types-sig] Static typing considered HARD
Gordon McMillan
gmcm@hypernet.com
Mon, 6 Dec 1999 15:21:09 -0500
Uche Ogbuji wrote:
[David Ascher on eGroups]
> > The latter. The quote (paraphrased from memory) is "When
> > someone changes a function interface, there's no way to know if
> > we've caught all of the calls to that function in the tens of
> > thousands of line of code that we have except to run the code'.
>
> Have they heard of Bertrand Meyer's open/closed principle? As I
> suspected, the root problem is poor software engineering, and has
> little to do with Python.
More practically, have they heard of grep?
While I will certainly agree that it's very irritating to bomb on a
typo after you've been processing for half an hour, I'm
skeptical that there's a "cure" worth the price, (I favor the Lint
approach to safety, because Lint is free to warn of
questionable practices without outlawing them).
I'm at the moment optimizing / debugging someone's Java
applet that contains 90 (yes, ninety) classes. Vast amounts of
this code exists purely to satisfy the Java compiler on
questions of type-safety. Despite all this work, it's still not
safe code.
The equivalent Python would probably take no more than a
dozen classes and be enormously easier to understand. Safer
off the bat? No. Easier to make truly safe? Yes.
My interest in "optional static typing" has always been in the
possbility of optimizations.
- Gordon