On 27 January 2017 09:23:38 GMT+00:00, Wes <netmo....@gmail.com> wrote:
>An alternative (which I haven't properly developed yet). Thoughts?
>\A\B\someFunction();
>// prints:
>// LOADING A\n
>// LOADING AB\n

As I understand it, PHP namespaces aren't really hierarchies, they just have a 
hierarchical naming scheme; so namespace \A is not actually being referenced 
here.


>\A\B\someFunction();
>// tries no autoload, because both namespaces A and A\B were
>// attempted to be loaded already.
>// in other words, autoload is attempted only once
>// for any given namespace

The tricky case that stalled the discussion of 
https://wiki.php.net/rfc/function_autoloading is using unqualified function 
names: if you're already inside the same namespace as the function, or alias it 
with "use function". I'm not sure how this mechanism would work for those cases.

Finally, suggestions of a single include per namespace haven't been universally 
popular in previous threads, because some projects genuinely prefer each 
function in its own file (think plugin functions for Smarty / Wordpress / etc).

It's an idea worth exploring though, IMO.

Regards,


-- 
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to