Req #52385 [Opn->Sus]: Support for autoloading functions
| From: | cmb@php.net | Date: | Sun, 17 Jun 2018 12:27:08 +0000 |
| Subject: | Req #52385 [Opn->Sus]: Support for autoloading functions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215760@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=52385&edit=1
ID: 52385
Updated by: cmb@php.net
Reported by: php-bugs at majkl578 dot cz
Summary: Support for autoloading functions
-Status: Open
+Status: Suspended
Type: Feature/Change Request
Package: SPL related
Operating System: Irrelevant
PHP Version: 5.3.3RC3
Block user comment: N
Private report: N
New Comment:
This feature clearly requires the RFC process. Either the
existing RFC âFunction Autoloadingâ[1] may be revived, or a new
RFC should be submitted[2]. I'm suspending this ticket for the
time being.
[1] <https://wiki.php.net/rfc/function_autoloading>
[2] <https://wiki.php.net/rfc/howto>
Previous Comments:
------------------------------------------------------------------------
[2010-08-07 15:38:24] php-bugs at majkl578 dot cz
It doesn't make any difference to me. I'm using tokenizer to look up for classes in all
files. Then I store them in an associative array (class=>file) and when the class is requested,
it is loaded according to this list.
With functions it'd be completely same. I don't think PHP should provide anything more,
just an autoloader to be used with user-defined callback (like spl_autoload_register does).
"With classes you often have one class per fileâ¦"
Often, but not always.
------------------------------------------------------------------------
[2010-08-07 01:51:34] johannes@php.net
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.
------------------------------------------------------------------------
[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 https://bugs.php.net/bug.php?id=52385&edit=1