2012/11/10 Laupretre François <francois.laupre...@francetv.fr> > Given the strong opposition of core devs against this feature in the past, > I want a vote on the RFC before I start working on a patch. > > Before this vote can take place, as you note, we need to solve the > function fallback issue: in theory, we should call the autoloader before > looking into the global namespace, but, in practice, most function calls > reference PHP internal functions, and the performance hit would be too big. > Forcing people to prepend a '\' to every function calls is also not > possible. So, the only remaining solution, IMO, is to call the autoloader > (first with NS suffix, then global) AFTER a global function lookup. In this > case, we must accept that namespaced functions named the same as a global > function may be incorrectly ignored in some cases. >
This only affects the situation, where a function is in the same namespace, where it is used, because else functions must get called with the namespace anyway use My\Foo; Foo\myFunction(); So in my opinion that behaviour is fine. It doesn't sound useful to name a function like a built-in ones anyway (this "overwrite existing ones" always seemed to be confusing in my eyes). > > François > > > -----Message d'origine----- > > De : Benjamin Eberlei [mailto:kont...@beberlei.de] > > Envoyé : jeudi 8 novembre 2012 11:53 > > À : PHP Internals > > Objet : [PHP-DEV] Autoload Functions RFC in 5.5? > > > > There is this wonderful RFC sitting around: > > > > https://wiki.php.net/rfc/autofunc > > > > Is there any chance that we can integrate this in 5.5 and somebody is > > willing to write this patch? > > > > The only topic missing from the RFC is how the fallback to global > > namespace works, if the autoloader is called before or after the > > fallback. > > > > greetings, > > Benjamin > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- github.com/KingCrunch