protocols, inheritance and polymorphism

Donn Cave donn at drizzle.com
Sat Nov 27 12:16:23 EST 2004


Quoth Jacek Generowicz <jacek.generowicz at cern.ch>:
[ ... re C++ casting to subtype ]
| Yes, you can "easily" do the work that the absent dynamic type system
| should be doing for you (and Turing equivalence tells us that that we
| can implement a decent dynamic type system as well). The fact remains
| that the objects *are* *dynamically* typed, even though the language
| claims to be statically typed. The fact that statically typed
| languages feel the need to introduce dynamic typing (however poorly
| supported it may be) in order to support OOP, points to the fact that
| static type systems DO have problems with OOP, which is what the
| question was about.
|
| Specifically, dynamic polymorphism is impossible without dynamic
| typing.

Given a model for polymorphism that means smuggling an object
around wrapped in some degree of mystery about its type, elegant
and sound static typing does seem unlikely.  But C++ and its
descendents have always been easy targets.  Would you happen to
know something about how Objective CAML's OO system approaches this?

I see in the on-line documentation this paragraph:

   Be aware that subtyping and inheritance are not related. Inheritance
   is a syntactic relation between classes while subtyping is a semantic
   relation between types. For instance, the class of colored points could
   have been defined directly, without inheriting from the class of points;
   the type of colored points would remain unchanged and thus still be a
   subtype of points. 

http://caml.inria.fr/ocaml/htmlman/manual005.html

I'm thinking that this might be more or less typical of academic
ideas about OO typing, and it seems conceptually appealing.  I
don't know the details though.

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list