[Zope3-dev] Chapter 1 Step 6 now available

sean.upton@uniontrib.com sean.upton@uniontrib.com
Wed, 20 Feb 2002 11:36:05 -0800


Assuming that the Decorator can change/add to the interface that the
decorated class can implement, I'd think that the decorated class would
potentially wrap the decorator's own __implements__ as part of  its own
__implements__???  Perhaps part of the problem, though, is that this might
need to be done to each instance of the decorated - not the decorated class
__implements__ itself, since instances of the same class using a different
decorator might implement different interfaces via instance attributes - not
class attributes?  

Put another way (forgive my ignorance here), how could one create content
components that have the ability to switch which interfaces they implement
on-the-fly if __implements__ is always a class attribute?  Or does the
Decorator pattern (formally) assume that each potential decorating class
will always assume the same interface as a guarantee against a need for
this, because the decorated needs to use that guarantee of a consistent
interface to utilize the decorator?

Sean

-----Original Message-----
From: Martijn Faassen [mailto:faassen@vet.uu.nl]
Sent: Wednesday, February 20, 2002 10:30 AM
To: Steve Alexander
Cc: Tres Seaver; Casey Duncan; zope3-dev
Subject: Re: [Zope3-dev] Chapter 1 Step 6 now available


Steve Alexander wrote:
[snip]
> That very accurately describes what my Decorator class does. The 
> interface it declares, via __implements__, is exactly the same as the 
> component it is decorating. However, it adds certain operations that 
> views can use *if* they know about them.

Isn't that scary? I mean, if I understand it well, a decorated object
supplies extra interfaces, but there's no way to find out by
checking __implements__ or using the introspection tools of the 
interfaces package, right? You just have to 'know' about this, and 
that could be troublesome -- it's why we want interfaces in the first
place.

Or am I missing something?

Regards,

Martijn


_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
http://lists.zope.org/mailman/listinfo/zope3-dev