Flying With Python (Strong versus Weak Typing)

A. Lloyd Flanagan alloydflanagan at attbi.com
Thu Mar 13 16:23:33 CET 2003


"Greg Ewing (using news.cis.dfn.de)" <me at privacy.net> wrote in message news:<b4odqg$21u9bt$1 at ID-169208.news.dfncis.de>...
> A. Lloyd Flanagan wrote:
 
> I don't think it's fair to blame the complexity and
> messiness of C++ on the idea of a parametric type
> system. The messiness of templates
> in C++ is mostly due to the grotty syntax chosen and
> the way they interact with other complicated and
> messy features of the language.
> 
> There are languages with parametric type systems
> (e.g. Haskell, Eiffel) where it doesn't seem to lead
> to any of those problems,

You're undoubtedly right.  Still, I now think the notion of type
should be 'an object which supports these operations', not 'an object
that inherits from this object (or objects)'.  If I've got an object
that implements read(), I want to be able to use it in a function that
calls read() on a parameter, without requiring the object and
parameter to both inherit from the same class.  You end up doing a lot
of inheritance, and defining extra interfaces, just to keep the
compiler happy.
In fact, just like templates, the whole concept of an interface in
Java exists to give capabilities to the programmer that the strong
typing took away.




More information about the Python-list mailing list