Re: Proposal for aggregation vs. MI

From: Date: Wed, 10 Apr 2002 20:04:49 +0000
Subject: Re: Proposal for aggregation vs. MI
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-82505@lists.php.net to get a copy of this message
At 12:46 10/04/2002 -0700, brad lafountain wrote:
--- Andi Gutmans <andi@zend.com> 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();
By the way, the aggregating class could also define it's own proxy a_print() and c_print() methods. I don't think it's very important because it will usually not happen and is easy to solve if it happens. With MI this kind of stuff stinks too. Andi

« previous php.dev (#82505) next »