[Types-sig] Interfaces API

Samuele Pedroni Samuele Pedroni <pedroni@inf.ethz.ch>
Thu, 15 Mar 2001 18:06:20 +0100 (MET)


> 
> We'll need to agree on an API for interfaces. 
The proposals express two orthogonal point of view that cannot simply be
merged, one can be intended as an extension/restriction of the other,
but IMHO they cannot be flatten down to the same thing.

> My API is very simple:
> 
> interface Interface:
>     """The shared behavior of interface objects"""
>     def __check__(self, obj)

This is the minimal requirement for something that I would call a domain.

>   
> Michel's is a little more "feature rich":
> 


> I'm surprised that you don't have the equivalent of my __check__. Given
> an object don't we want a way to ensure that it really does have the
> right names, methods with the right parameters and so forth? In my mind,
> __check__ is the major feature required for runtime checks.
> Python Cookbook!  http://www.activestate.com/pythoncookbook

because as far as I have understood: the semantic of the following definition
is that:

class A implements I:
 ...
 
should enforce through a check that A offers all the signatures required by I.
And conventionally expresses that A meet all of the implicit requirements
(not at signature level) that come with I.

regards, Samuele.