[Zope-dev] Acquisition Confusion :S

Chris Withers chrisw@nipltd.com
Wed, 02 Aug 2000 13:58:34 +0100


Evan Simpson wrote:
> Here are the two and a half rules for deriving acquisition from a dotted
> expression:
> 
> 1.  A.B == (B o A), where A is an unwrapped object
> 
> 2.  (self o parent).B ==
>     a. (self.B o (self o parent)), if B is found in 'self'
>     b. (parent.B o (self o parent)), if B is found in 'parent'

Who decided these rules and why are they like they are?

So, is the working below now correct? (I feel like I'm back in School
doing maths ;-)

> > A has attributes B and C, C has attribute D

A.B.C.D = (B o A).C.D                                 - rule 1
        = (A.C o (B o A)).D                           - rule 2b
        = ((C o A) o (B o A)).D                       - rule 1
        = ((C o A).D o ((C o A) o (B o A)))           - rule 2a
        = ((C.D o (C o A)) o ((C o A) o (B o A)))     - rule 2a
        = (((D o C) o (C o A)) o ((C o A) o (B o A))) - rule 1

Now, if you apply simplification one way (top to bottom?) you get:
        = ((D o C) o ((C o A) o (B o A)))             - simplification
...which can't be simplified, AKAICS

However, if you simplify bottom to top, you get:
        = (( D o (C o A)) o ((C o A) o (B o A)))      - simplification
        = ( D o ((C o A) o (B o A)))                  - simplification

..which is what you got. Where is the order of simplification defined?
Is there a 'correct way'? Does it make a difference? (the above example
would seem to suggest not, other than in searchign efficiency) 
...and of course, how does Zope do it?

<snip>
> In other words, aq_inner is the left-inner-most wrapper.  Find the leftmost
> 'o' in the expression, and you've got it.

Thanks, that's _much_ cleaer than the slides :-)

cheers,

Chris