On 3 February 2018 08:27:18 GMT+00:00, Wes <netmo....@gmail.com> wrote: >Hello PHPeople. I just published the RFC "Deprecation of fallback to >root >scope". > >It is quite a substantial change, but as you can read in the RFC, can >be a >(basically) transparent one. >I'm referring to the possibility to shim it in userland.
I'm torn on this one. On the one hand, I think in hindsight this is how functions in namespaces should have worked when they were introduced in PHP 6, I mean 5.3. \foo isn't the prettiest syntax, but people soon got used to writing class names that way, including built in ones like \DateTime. It would make function autoloading simpler, lead to less ambiguous code, and make namespaces work consistently across token types, rather than one way for classes and a different way for functions and constants. On the other hand, the BC break of moving to that now (or committing ourselves to in the future) is significant, and even raising a notice of whatever level could be highly disruptive. A lot of code bases will issue this message hundreds or thousands of times; I wouldn't be surprised if just the code to format the string and pass it to an active error handler might result in a measurable performance impact in some cases. Crucially, the proposed shim can't actually be written yet, so the only way to suppress these notices will be to edit every single source file, which even if perfectly automated creates a lot of noise in version control. I think some less invasive way would need to be found to make existing code run the same way, without notices, before and after the change. For instance, if you could opt into the old behaviour by writing "import global functions" at the top of a file, or opt into the new behaviour by writing "namespace only Foo", or since autoloading is a key benefit, "namespace Foo with autoload". It wouldn't be ideal, because it means the engine has to support both modes, but it would be far less painful than adding \ into thousands of lines of existing code. Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php