Req #52385 [Opn]: Support for autoloading functions
| From: | johannes@php.net | Date: | Fri, 06 Aug 2010 23:51:34 +0000 |
| Subject: | Req #52385 [Opn]: Support for autoloading functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-153193@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
Updated by: johannes@php.net
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
Block user comment: N
New Comment:
With classes you often have one class per file, with functions not which
makes the lookup usually way more complex; I don't see us adding this.
Previous Comments:
------------------------------------------------------------------------
[2010-07-24 07:00:14] php-bugs at majkl578 dot cz
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()).
------------------------------------------------------------------------
[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