protocols, inheritance and polymorphism
danperl at rogers.com
Wed Nov 24 07:02:05 CET 2004
"Donn Cave" <donn at drizzle.com> wrote in message
news:1101273995.954137 at yasure...
> Quoth "Dan Perl" <danperl at rogers.com>:
> | "Donn Cave" <donn at u.washington.edu> wrote in message
> | news:donn-D778C1.17100223112004 at gnus01.u.washington.edu...
> | > I'm very sympathetic to the advantages of static typing
> | > (NB, I read here that Python is strongly, though dynamically,
> | > typed. It is not statically typed.) Rather than embrace
> | > subtype polymorphism through inheritance, however, I see it
> | > as evidence that no one has figured out how to make static
> | > typing really work with OOP. There has to be a better way
> | > to do it.
> | You're right, I should have said statically typed instead of strongly
> | But did you really mean "no one has figured out how to make *static*
> | really work with OOP" or did you mean *dynamic* typing?
> Static. I figure dynamic & OOP get along fine -- as Smalltalk showed,
> along with I believe Objective C and of course Python. Static typing
> and Functional Programming seem to go hand in glove, cf. Haskell type
> classes. Static OOP seems to invite inelegant and unsound compromises.
It's hard to argue against Smalltalk. I haven't used it for many years so I
don't remember it but it was THE language of choice for an OOP course I took
oh so many years ago. And I still see it mentioned as a model for OOP. I
never learned Objective C so I cannot argue with that either.
Unfortunately, as much as I am learning to like Python, I don't think I see
it as a picture perfect OOP language. It may be a controversial opinion but
I am not at all satisfied with encapsulation in Python (you cannot hide any
of a class's implementation).
Can you elaborate on problems that static languages have with OOP? We have
been touching on parametric polymorphism and that is a valid point. I also
see multiple inheritance as being very poorly implemented in C++ and Java to
the point where books on C++ that treat the subject discourage you from
using it and Java has effectively designed it out of the language (you can
implement many interfaces but you can extend only one class). What do you
have in mind?
> Donn Cave, donn at u.washington.edu
More information about the Python-list