Re: Re: Function Cache
| From: | Sterling Hughes | Date: | Mon, 11 Dec 2000 13:02:16 +0000 |
| Subject: | Re: Re: Function Cache | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.dev php.pear |
| Request: | Send a blank email to php-dev+get-40832@lists.php.net to get a copy of this message | ||
> Sterling Hughes wrote:
> >
> > Stig Bakken wrote:
> > >
> > > The way I see it, don't get the real payoff of autoloading until you can
> > > autoload the classes themselves.
> > >
> >
> > Come again, I don't quite understand you meaning. do you mean:
> >
> > class AUTOLOAD
> > {
> > function AUTOLOAD($class, $funcname)
> > {
> > print "$class [$funcname]: ";
> > var_dump(func_get_args());
> > }
> > }
> >
> > $obj = new Mike($hello);
> >
> > would print out
> >
> > Mike [Mike]: The contents of $hello
>
> We're talking about different things. Your "autoload" is not really for
> autoloading anything (AFAIK you can't add methods to objects), but for
> catching "undefined function" errors.
>
> The autoloading I'm talking about is when you do "new foo_bar", and it
> require_onces "foo/bar.php" if the foo_bar class does not exist.
>
> The object proxy'ing I'm talking about is an implementation similar to
> that of ext/java and ext/com, where you overload an object so you can
> catch all method calls and property accesses, and "re-route" them in the
> C code, calling caching hooks (that's why you pass a reference to the
> original object).
>
Ok, I'm using the autoload function as a direct result of Perl experience. The
AUTOLOAD function is automagically loaded whenever a non-existant function is
called. This allows for some really cool things such as the function caching,
easy XML creation (just have method calls be the names of XML tags and go from
there...), HTML creation, and other things become possible as well....
-Sterling