Re: [PHP] Procedural Autoloader?

2010-11-23 Thread Steve Staples
On Mon, 2010-11-22 at 15:26 -0800, David Harkness wrote: > On Mon, Nov 22, 2010 at 3:05 PM, Richard Quadling wrote: > > > Would it be overboard to use a namespace? Aren't namespaces handled by > > the autoloader? If not autoload(), how about spl_autoloading? > > > > Autoloading is for determining

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread David Harkness
On Mon, Nov 22, 2010 at 3:05 PM, Richard Quadling wrote: > Would it be overboard to use a namespace? Aren't namespaces handled by > the autoloader? If not autoload(), how about spl_autoloading? > Autoloading is for determining the path and filename where a named item is defined. Namespaces only g

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread Richard Quadling
On 22 November 2010 22:02, David Harkness wrote: > The simplest solution would be to move those functions into static methods > of classes. Place one class in each file to organize your functions and use > an autoloader to load the classes. You don't need to instantiate the class > to use the auto

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread Daniel Brown
On Mon, Nov 22, 2010 at 16:47, Peter Lind wrote: > > Not to mention that it has nothing to do with a procedural autoloader. > Autoloading takes place if you try to instantiate an object of a class > that PHP doesn't know about (yet). There is no such thing for > functions. Either refactor your cod

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread David Harkness
The simplest solution would be to move those functions into static methods of classes. Place one class in each file to organize your functions and use an autoloader to load the classes. You don't need to instantiate the class to use the autoloader--just reference it statically: // library/Math

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread Jason Pruim
On Nov 22, 2010, at 4:24 PM, Daniel P. Brown wrote: On Mon, Nov 22, 2010 at 15:37, Jason Pruim wrote: Hey Everyone! Fresh off my problem with functions and arrays I come across something that I can't seem to find currently... The autoloader function that is in PHP 5+ works on classes...

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread Peter Lind
On 22 November 2010 22:40, Daniel P. Brown wrote: > On Mon, Nov 22, 2010 at 16:31, Nathan Nobbe wrote: >> >> Shrug, if you want to really be dirty about it, you could just put a 'class' >> atop each file of functions. >> > class IWishTheseFunctionsWereOOInstead {} // :P >> function firstProceedur

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread Daniel P. Brown
On Mon, Nov 22, 2010 at 16:31, Nathan Nobbe wrote: > > Shrug, if you want to really be dirty about it, you could just put a 'class' > atop each file of functions. > class IWishTheseFunctionsWereOOInstead {} // :P > function firstProceeduralFunc() { >  // .. > } > ?> That's not going to be ec

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread Nathan Nobbe
On Mon, Nov 22, 2010 at 2:24 PM, Daniel P. Brown wrote: > On Mon, Nov 22, 2010 at 15:37, Jason Pruim > wrote: > > Hey Everyone! > > > > Fresh off my problem with functions and arrays I come across something > that > > I can't seem to find currently... The autoloader function that is in PHP > 5+ >

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread Daniel P. Brown
On Mon, Nov 22, 2010 at 15:37, Jason Pruim wrote: > Hey Everyone! > > Fresh off my problem with functions and arrays I come across something that > I can't seem to find currently... The autoloader function that is in PHP 5+ > works on classes... But I'm not finding anything that would do the same

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread Daniel P. Brown
On Mon, Nov 22, 2010 at 15:37, Jason Pruim wrote: > Hey Everyone! > > Fresh off my problem with functions and arrays I come across something that > I can't seem to find currently... The autoloader function that is in PHP 5+ > works on classes... But I'm not finding anything that would do the same

Re: [PHP] Procedural Autoloader?

2010-11-22 Thread David Harkness
On Mon, Nov 22, 2010 at 12:37 PM, Jason Pruim wrote: > The autoloader function that is in PHP 5+ works on classes... But I'm not > finding anything that would do the same thing on the procedural end. > I'll start by explaining how it typically works with classes. The Zend Framework is a popular w