Re: [PHPTAL] require_once vs autoloading

2010-06-05 Thread romtek
On Tue, Jun 1, 2010 at 11:10 PM, Tjerk Meesters tjerk.meest...@gmail.comwrote: I could be wrong here, but I think it's not so much any problem with require_once as it is to reduce memory consumption while using the library. This happens when developers only use 30% of the library and yet the

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Kornel Lesiński
On 02-06-2010 at 05:10:07 Tjerk Meesters tjerk.meest...@gmail.com wrote: I could be wrong here, but I think it's not so much any problem with require_once as it is to reduce memory consumption while using the library. This happens when developers only use 30% of the library and yet the whole

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Kornel Lesiński
On 02-06-2010 at 09:56:23 Robert Goldsmith rgoldsm...@names.co.uk wrote: I think autoloading is a good idea but please keep in mind that the app the phptal is being used within may already have autoloading configured. a prime example would be Zend. I've used spl_autoload_register(). Does

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Robert Goldsmith
No idea :) However, if you allowed for autoloading to be optional then if needed people could turn it off and replace it with an external system such as Zend's. Maybe moving the autoloader into its own file and telling people they need to require_once the file if they wish to use the phptal

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Tjerk Meesters
Hi, Zend uses spl_autoload_register() as well I believe, so that should be safe. The main problem I can see is that if there's an existing __autoload() function, spl_autoload_register() will replace it (as stated in the manual). I don't think putting the autoloader in a separate file will make a

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Kornel Lesiński
On 02-06-2010 at 10:33:00 Robert Goldsmith rgoldsm...@names.co.uk wrote: No idea :) However, if you allowed for autoloading to be optional then if needed people could turn it off and replace it with an external system such as Zend's. Maybe moving the autoloader into its own file and

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Kornel Lesiński
On 02-06-2010 at 10:58:41 Tjerk Meesters tjerk.meest...@gmail.com wrote: Zend uses spl_autoload_register() as well I believe, so that should be safe. The main problem I can see is that if there's an existing __autoload() function, spl_autoload_register() will replace it (as stated in the

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Kornel Lesiński
On 02-06-2010 at 11:10:43 Robert Goldsmith rgoldsm...@names.co.uk wrote: Why would someone choose to replace PHPTAL's autoload with something else? (I'm not implying it's perfect or such, just wondering what problem would such option solve). If people already have autoloader code and wish

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Robert Goldsmith
I'd have thought that code would do the job assuming it doesn't clobber any previously registered autoloaders. I'd prefer it wrapped up in a little function, however, just for convenience :) By my understanding, you don't need to actually call the autoload method '__autoload' so you could

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Tjerk Meesters
2010/6/2 Kornel Lesiński kor...@aardvarkmedia.co.uk: On 02-06-2010 at 11:10:43 Robert Goldsmith rgoldsm...@names.co.uk wrote: Why would someone choose to replace PHPTAL's autoload with something else? (I'm not implying it's perfect or such, just wondering what problem would such option

Re: [PHPTAL] require_once vs autoloading

2010-06-02 Thread Robert Goldsmith
require_once PHPTAL.php; spl_autoload_unregister(array('PHPTAL','autoload')); // if needed: spl_autoload_register('__autoload'); Would that be OK? Wouldn't that cause issues when PHPTAL needs to load more classes during the course of the script's execution? I think the idea is that this

[PHPTAL] require_once vs autoloading

2010-06-01 Thread romtek
Kornel, I've noticed this item on phptal.org: Removed all require_once and switched to autoloading. What are the problems with using require_once? Roman ___ PHPTAL mailing list PHPTAL@lists.motion-twin.com

Re: [PHPTAL] require_once vs autoloading

2010-06-01 Thread Tjerk Meesters
I could be wrong here, but I think it's not so much any problem with require_once as it is to reduce memory consumption while using the library. This happens when developers only use 30% of the library and yet the whole shebang is loaded on every request ;-) On Wed, Jun 2, 2010 at 5:20 AM,