Req #52385 [Opn]: Support for autoloading functions
| From: | php-bugs at majkl578 dot cz | Date: | Sat, 24 Jul 2010 05:00:15 +0000 |
| Subject: | Req #52385 [Opn]: Support for autoloading functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152704@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52385&edit=1
ID: 52385
User updated by: php-bugs at majkl578 dot cz
Reported by: php-bugs at majkl578 dot cz
Summary: Support for autoloading functions
Status: Open
Type: Feature/Change Request
Package: SPL related
Operating System: Irrelevant
PHP Version: 5.3.3RC3
New Comment:
Decoded version (really nice bug :)):
Would it be possible to add a support for autoloading user-defined
functions? Currently only classes are supported by either __autoload or
spl_autoload or spl_autoload_register.
Including all functions is really awful job whereas classess could be
autoloaded nicely (imagine implementation for spl_autoload_register
which scans a directory for classess and then includes specific file).
I suggest to make possible something similar to the example above for
normal functions (global as well as those in namespaces).
PS: I know that it could be hacked by emulating namespace with class
(eg. static method String::webalize()) but since PHP 5.3 it would be
probably nicier not to hack it with classes, but place it to namespace
as a regular function (String\webalize()).
Previous Comments:
------------------------------------------------------------------------
[2010-07-21 05:29:55] php-bugs at majkl578 dot cz
Description:
------------
Would it be possible to add a support for autoloading user-defined
functions? Currently only classes are supported by either __autoload or
spl_autoload or spl_autoload_register. Including all
functions is really awful job whereas classess could be autoloaded
nicely (imagine implementation for spl_autoload_register which scans a
directory for classess and then includes specific
file). I suggest to make possible something similar
to the example above for normal functions (global as well as those in
namespaces). PS: I know that it could be hacked by
emulating namespace with class (eg. static method String::webalize())
but since PHP 5.3 it would be probably nicier not to hack it with
classes, but place it to namespace as a regular function
(String\webalize()).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52385&edit=1