Who's minister of propaganda this week?
aleaxit at yahoo.com
Sun Mar 18 21:15:11 CET 2001
"Paul Prescod" <paulp at ActiveState.com> wrote in message
news:mailman.984939085.7872.python-list at python.org...
> Michael Chermside wrote:
> > But I'm quite surprised that you think you pay a 10% penalty
> > for going through contortions to adhere to static typechecking.
> > You see... in my own experience, I hardly ever want to violate
> > it. I generally design type hierarchys and use objects in places
> > where I expect an object of that type or of a direct ancestor.
> One issue is that you often do not have control over the design of type
> hierarchies. You need to glue together two or more large frameworks and
> you have no opportunity to set up interfaces etc. as you want.
Good point. You work around _that_ one with templates, delegation,
multiple inheritance, etc, but the productivity impact easily exceeds
10% for this specific problem, in my experience.
> Another issue is that there are certain kinds of advanced programming
> that are are exceedingly difficult in statically typed languages. For
Right again. Besides the specific example you give, I think a very
instructive experience is comparing the base version of "Design
Pattern" (C++ oriented) with the "Design Pattern Smalltalk Companion"
book; despite only having single inheritance in Smalltalk, you will
notice that in at least about one case in three (and we're talking
specifically of pattterns designed for a statically typed language!)
the Smalltalk version is slimmer and handier (a Python one, I think,
might easily show another small advantage yet).
Yet another example is the "Acyclic Visitor" pattern (by R. Martin)
which I already mentioned recently -- it specifically uses the dynamic
typing "escape" of C++ (dynamic_cast<>) to greatly enhance the
dependency-control characteristics of the "Visitor" pattern (removing
the cycle of dependencies that make it such a bother). Imagine
"just doing it" rather than having to set everything up so carefully
and delicately each and every time static-typing imposes such costs
on your designs (e.g., nasty dependency graphs) -- indeed, not
having to worry about it _at all_ (which leads to easy consideration
of many more architectures, with increased likelihood of finding the
optimal one) -- and I think you'll see that my claim of a 10% overall
productivity gain for dynamic typing over static is rather modest.
More information about the Python-list