COM's a hack, though.  It really is.
COM's entire design was derived from the need for binary compatibility 
between components, which plays absolutely no role in PHP.  They had to go 
through hoops in and some real ugly hacks to achieve their goal (which they 
have, quite successfully, I have to say).  What they did in ATL basically 
does a fair amount of magic to give you the ability to inherit code with 
COM's strict binary compatible model...
COM's aggregation is implemented in userspace, even though it's very 
standard (through QueryInterface).  A PHP equivalent would be providing a 
getSubObject() class, that would simply return an inner object, that you 
can use directly.  Aggregation is typically very very simple, and rarely 
requires any 'inner' modifications of the object's layout.

I'm personally in favour of having MI in PHP, with the serious alternative 
being interfaces.  I have failed to understand what interfaces would mean 
in a language such as PHP, though, while I can see the clear hands-on use 
for MI.  Can you explain how you envision interfaces as useful constructs 
in PHP, and their advantages over MI, considering the fact all of the 
binary compatibility issues don't apply?

Zeev

At 12:09 09/04/2002, Wez Furlong wrote:
>COM!
>
>COM uses all of this kind of stuff (implemented in various ways through
>inheritance, aggregation via template classes, proxies and delegates).
>
>And why go to all this trouble?  So that your code can work with code
>written by third parties that have no knowledge of your code, nor yours
>of their code.
>
>So it's really "just" interfaces then, but more flexible because you
>are not limited to just implementing interfaces.
>
>--Wez.
>
>On 09/04/02, "Zeev Suraski" <[EMAIL PROTECTED]> wrote:
> > I'm not saying you can't find a use for it, I'm sure you can.  I'm saying
> > that aggregation the way you use it is something that at least I have 
> never
> > seen used anywhere else before.  I've never seen an object oriented 
> program
> > that is written without knowing anything about the classes it's going to
> > work with, it doesn't make too much sense...  or does it?
> > In your example, I understand what it does, but I don't understand what's
> > the advantage over MI in this case.
> >
> > At 11:53 09/04/2002, Kristian Koehntopp wrote:
> > >On Tue, Apr 09, 2002 at 12:11:11AM +0300, Zeev Suraski wrote:
> > > > Having both makes very little sense.  Compile-time vs.
> > > > run-time in PHP doesn't make any real difference as far as
> > > > functionality goes, because the stages are linked together
> > > > immediately.
> > >
> > >Not the point here. In
> > >
> > >class D extends A, B, C ...
> > >
> > >the class names are static (determined at compile-time). In
> > >
> > >$classes = array("A", "B", "C", "D");
> > >$d = new Object; // Object is an empty class.
> > >foreach($classes as $c) {
> > >   aggregate($d, $c);
> > >}
> > >
> > >the class names are variables, and in fact, aggregate could and
> > >should take an array as well as a string as the second parameter
> > >in the first place.
> > >
> > >Kristian
> > >
> > >--
> > >Kristian Köhntopp, NetUSE AG, Dr.-Hell-Straße, D-24107 Kiel
> > >Tel: +49 431 386 435 00, Fax: +49 431 386 435 99
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, visit: http://www.php.net/unsub.php


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

Reply via email to