Re: Proposal for aggregation vs. MI
| From: | Andi Gutmans | Date: | Wed, 10 Apr 2002 19:53:14 +0000 |
| Subject: | Re: Proposal for aggregation vs. MI | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-82502@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 {Told you I didn't read all Emails :)...} 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();I was thinking that we could have an explicit way of calling the right one. I do think that this by far the best solution because as I said it's extremely simple and it doesn't get us into most of the deep issues the other solutions get us into. I think in real life coding it will work extremely well. For each proposal you can find problems.
and how does this consern serilization. Would it need to be change do designate which objects are aggregated?Each object would know which objects it aggregates so I don't see a real big problem here. I guess potentially there are always problems when serializing nested objects. Andi