[Types-sig] Interfaces should be on the table
Sun, 23 Jan 2000 20:39:04 -0600
I think that interfaces should be on the table for version 1 of the type
system for the following reason.
The three ways that static type checking could most go "against the
grain" of Python and thus destroy its beauty are:
* they become mandatory (or contagious) so that beginners had to learn
them for trivial operations
* they stop people from doing really dynamic stuff in Python. (I'm
happy to restrict really dynamic stuff in *checked code* but not in
* they destroy the awesome genericity that has been growing throughout
the Python library wherein mappings can be used anywhere dictionaries
can be, sequences anywhere lists can be and so forth.
When I hear people get nervous about type safety it is almost always
these three things that they are nervous about (and sometimes a vague
syntactic sense that anything with type declarations "is not Python").
Practically speaking, there is no reason to take interfaces off the
table. They are simpler than parameterized types (for example) and are
implicit in any discussion of the distinction between subtyping and
subclassing. Which brings me to...
> After reading part of [Bruce96]: maybe we need to separate the notion
> of subtyping and subclassing.
This is precisely what interfaces do and they do it in a clear,
unambiguous, syntactic way. It is through interfaces that Sather gets
around Eiffel's covariance "issues" and Java gets around difficulties of
multiple inheritance in deeply nested class libraries.
Paul Prescod - ISOGEN Consulting Engineer speaking for himself
Earth will soon support only survivor species -- dandelions, roaches,
lizards, thistles, crows, rats. Not to mention 10 billion humans.
- Planet of the Weeds, Harper's Magazine, October 1998