--- Andi Gutmans <[EMAIL PROTECTED]> wrote:
> Hey guys,
> 
> I still haven't finished reading the looooooong thread on aggregation vs. 
> MI because you guys write so much :)
> I would like to make a proposal for a solution which I think would fit PHP 
> very nicely.
> My main concern with MI is that there are many problems with it including 
> namespace clashes and other problems most of you are probably familiar 
> with. I think trying to work around and find solutions for all of these 
> would make a PHP implementation of MI extremely hard to use and would move 
> away from the spirit of PHP which is powerful simplicity.
> What I have in mind is something similar to aggregation (in the original 
> C++ sense which means a "has a" relationship) but improve it with an 
> auto-proxy mechanism.
> Basically what I'd like to have is something like:
> 
> class a aggregates b, c {
>       ...
> }

 I did suggest this method already.
But it really doesn't address the naming clash

class b
{
 function print()
 {
 }
}

class c
{
 function print()
 {
 }
}

class a aggregates b, c
{
}
$a = new A();

$a->print();
you said in the order they were aggregated. but what if i really want to call 
c->print();

would i do something like this.
$a->c->print();

and how does this consern serilization. Would it need to be change do designate
which objects are aggregated?

 - Brad

> 
> What would happen is that 'a' will hold an instance of 'b' and an instance 
> of 'c' like the old historic meaning of aggregation.
> However, when a method is called on 'a' and is not found we would 
> automatically proxy the method call to these instances (in the order of 
> their aggregation) and call the first existing one.
> The plus is that you get something very similar to MI without having to 
> deal with namespace clashes such as problems when b and c have the same 
> variable name. Each object lives on its own but you get a central object 
> which reflects the interfaces of all three objects.
> 
> This is a very elegant and simple IMO. It should answer most needs.
> I hope I explained it well. Let me know if you have any questions.
> Andi
> 
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to