> -----Original Message-----
> From: Nathan Nobbe [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 12, 2008 3:08 PM
> To: Andrés Robinet
> Cc: Robert Cummings; Zoltán Németh; Greg Donald; php-general@lists.php.net
> Subject: Re: [PHP] What's wrong the __autoload()?
> 
> On Wed, Mar 12, 2008 at 2:53 PM, Andrés Robinet <[EMAIL PROTECTED]>
> wrote:
> 
> > I think __autoload would make much more sense if it worked like an event
> > registration feature. Such as:
> >
> > function myAutoloadCallback($className) {
> >        if ($className == 'ShakeItBaby') {
> >                require_once 'ShakeItBaby.class.php';
> >                return true;
> >        }
> >        return false;
> > }
> > .....
> >
> > __autoloadRegisterCallback('myAutoloadCallback');
> > .....
> >
> > $shaker = new ShakeItBaby();
> >
> > This way, multiple frameworks and project requirements for autoload
> > wouldn't clash. If one of the autoload callbacks returns "true" that
> would
> > be it. Otherwise the next autoload callback would be called, and so on.
> >
> > The problem with the current implementation is that if you get some piece
> > of code that uses __autoload and you are using __autoload too, you'll
> have
> > to either patch that piece of code (if the "piece of code" is a
> framework,
> > things will get much more complicated when updating to the next version)
> or
> > patch your own code, or just make a promise not to use __autoload (my
> > current choice... just in case) or not to use "pieces of code that use
> > __autoload". Bottom line, I hate it.
> 
> 
> as eric pointed out earlier, thats what spl_autoload_register is for;
> http://us.php.net/manual/en/function.spl-autoload-register.php
> 
> -nathan

I know, I was talking about the "old/regular" __autoload feature. You need PHP 
5 for spl_autoload_register... but having all PHP 5's nice OOP features, you 
probably want to code a class/file/function/resource loader class (like ZF 
does) which can do much more. For PHP 4, you are stuck. But anyway, PHP 4 is 
"dying"... or seems to be.
And don't speak about SPL, I had the worst of disappointments with 
ArrayObject... since then I got divorced with it (probably will marry it again 
in the future, my ancestors are French, you know French people are 
passionate... and they like cooking too).

Now, what about set_error_handler? Maybe it's something to discuss in it's own 
thread, I don't know.

Anyway, anyway, anyway.... must get back to regular work :(

See you later,

Rob(inet)

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 | 
TEL 954-607-4296 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |  
Web: bestplace.biz  | Web: seo-diy.com




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to