Req #52385 [Opn]: Support for autoloading functions
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 Block user comment: N New Comment: 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. Previous Comments: [2010-08-07 01:51:34] johan...@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 http://bugs.php.net/bug.php?id=52385&edit=1
Req #52385 [Opn]: Support for autoloading functions
Edit report at http://bugs.php.net/bug.php?id=52385&edit=1 ID: 52385 Updated by: johan...@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
Req #52385 [Opn]: Support for autoloading functions
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