Re: Function auto-loading
| From: | Rowan Collins | Date: | Mon, 08 Aug 2016 16:55:38 +0000 |
| Subject: | Re: Function auto-loading | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-94940@lists.php.net to get a copy of this message | ||
On 08/08/2016 17:23, Niklas Keller wrote:
Loading only full qualified names will lead to strange bugs.The suggestion is to require *qualified* names (at least one \ in the call), not to require *fully qualified* names (leading \ and full namespace path). Function name resolution already requires that to reference anything other than a global function, or the exact current namespace. The only scheme I can think of where it would matter is one-function-per-file, like Smarty's plugin loader. # file foo.php namespace Acme\Plugins; function foo() { echo 'Hello world'; } # file bar.php namespace Acme\Plugins; function bar() { foo(); } # will not autoload Compared to "hundreds of lines of existing code will go slowly unless you liberally sprinkle with \", having to remind people not to do that seems like a small price to pay. Regards, -- Rowan Collins [IMSoP]