[Zope3-dev] Proposal: Improving on __implements__
Phillip J. Eby
pje@telecommunity.com
Sun, 19 Jan 2003 08:32:17 -0500
At 11:15 AM 1/19/03 +0200, Steve Alexander wrote:
>However, I still need the registry to make declarations for builtin
>classes and other classes where the class object itself is immutable.
Doesn't that registry (typeImplements) already exist?
>I'd rather spell this as below, to get rid of the class.__implements__:
>
> declareImplements(ServiceSubscriberEventChannel, IBindingAware)
> declareImplementsLike(ServiceSubscriberEventChannel,
> EventChannel, SubscriptionTracker)
And the 'implements()' in the class body isn't a "declaration",
too? ;) Perhaps the "magic" one should be called
'instancesImplement()'. The bare word 'implements' is a lousy name for an
API, even for what it means now.
>I'd like to remove all reference to an '__implements__' attribute from
>regular code.
I'm +1 on that *goal* - just not necessarily via the spelling I've seen so far.
Here's a crazy one:
class Foo(Bar, implements(Baz, Spam, interfacesOf(Thingy))):
...
It's of course crazy because it's going to mess with the MRO of the
result. But it's closest to simulating a Java-style "implements"
clause. I don't care for a bare 'implements' in the body of the class, but
it just might work in the bases. But I don't think it's worth the cost of
(up to) doubling the length of the MRO.