Hi,

I think that if we go my way with aggregation we can add the ability to add 
aggregated classes at run-time too and answer your needs.
However, I think that if we continue on much longer with trying to put all 
possible OOP features into Engine 2 it will never become a reality.
I would like to make the aggregation patch the last thing in Engine 2 and 
then start working on testing it and working towards PHP 5.
Otherwise we will never have a next version of PHP. There have been so many 
changes and lots of good changes we just can't do too much at once. We 
should do a feature freeze right after aggregation or we will be left with 
lots of discussions and ideas but no next version... It needs lots and lots 
of testing so that we can iron out all of the bugs.
There can always be PHP 6 later on. I think feature wise the Engine 2 is a 
big step forward for PHP and we should try and get it out!

Andi

At 13:24 11/04/2002 -0500, Andrei Zmievski wrote:
>Andi Gutmans wrote:
> > I'll sum up my proposal again.
> > Support the following:
> > class MyClass extends MyParent aggregates Timer, FooBar
> > {
> > }
> >
> > $obj = new MyClass; // Creates $obj->Timer and $obj->FooBar
> > $obj->method(); // Searches MyClass, MyParent if not found tries to
> > call the method on $obj->Timer followed by $obj->FooBar
> >
> > If you want to access an aggregated object directly you can do:
> > $obj->Timer->method();
> >
> > Got to go to bed now ;)
>
>Andi,
>
>This is a good proposal. However, there won't be any way to add methods
>at run-time? I will give you a specific example where I would need it.
>
>For a long while we wanted to separate Smarty into several component
>classes: caching class, compiler class, debugging class etc. The
>simplest one would be the driver class that took a name of the template
>to display and then performed certain actions depending on whether
>template cache is expired, etc. The way we could do it with aggregation
>is this:
>
>class Smarty {
>    function display($tpl)
>    {
>      if ($tpl->need_to_recompile($tpl)) {
>                 include_once "Smarty_Compiler.class.php";
>             aggregate($this, 'Smarty_Compiler');
>                 $this->compile($tpl);
>      }
>
>         if ($this->cache_expired($tpl)) {
>                 include_once "Smarty_Cache.class.php";
>                 aggregate($this, 'Smarty_Cache');
>                 $this->make_cache($tpl);
>         }
>    }
>}
>
>Basically, the class adds methods only when they are needed. This avoids
>unnecessary compilation of Smarty_Compiler.class.php and
>Smarty_Cache.class.php. I can't see a way of doing this with your
>proposal..
>
>-Andrei
>
>Atoms, once drawn into the torrent of living matter, do not readily leave it.
>   - Vladimir Vernadsky


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

Reply via email to