[Types-sig] Re: Types-SIG digest, Vol 1 #13 - 2 msgs
Gordon McMillan
gmcm@hypernet.com
Tue, 1 Dec 1998 10:48:47 -0500
> [Dominic Binks]
> > ...
> > I would hazard a guess that may be as much as 90% of Python code
> > is regularly type following.
[Tim Peters]
> I'd bet that's on the high side of the truth. From the
> Walker/Griswold paper I posted a link to over the weekend,
>
> An empirical study using the type inference system described
> here was conducted on a large number of Icon programs written by
> many different authors for a wide variety of applications. The
> results, which are conservative, show a range of type
> consistency from about 60 to 100%, with an average of about 80%.
> That is, on the average, the operands of about 80% of the
> operators in these programs always have the same type.
>
> It's likely lower in Python, because (I believe) Python programmers
> write more polymorphic functions than do Icon programmers.
From my own code, I'd guess that at least 90% of the time type(x)
is constant. But where type(x) == InstanceType or ClassType, I'd
guess that less that 50% of the time is x.__class__ constant, and
frequently the values are not even related by inheritance.
So resolving the class / type problem means interfaces are necessary
for optional static typing, while interfaces changes the obvious way
to do optional static typing and probably also the reformation of the
class model that goes with the type / class reformation, and optional
static typing probably affects the other two similarly.
time-for-a-little-deus-ex-machina-ly y'rs
- Gordon