Re: [RFC][DISCUSSION] Deprecation of fallback to root scope

From: Date: Wed, 07 Feb 2018 16:40:15 +0000
Subject: Re: [RFC][DISCUSSION] Deprecation of fallback to root scope
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-101802@lists.php.net to get a copy of this message
On 7 February 2018 at 15:20, Christoph M. Becker <cmbecker69@gmx.de> wrote: > On 07.02.2018 at 15:02, Rowan Collins wrote: > > > - PHP 7.3: Add syntax to explicitly reference functions and constants in > > the current namespace, such as .\foo or this\foo > > It is already possible to use the namespace keyword for this, > see > <https://3v4l.org/bikjE>. > Huh, I never knew that! Funnily enough, I thought of that as a possibility (because it's already a reserved word) but rejected it as too long. :P > > - Slightly uglier syntax. > > IMHO, .\foo is very ugly, and namespace\foo is not much better. > Yeah; the question is whether that ugliness is something we're willing to live with for the performance and features it would enable. Most code would still be less ugly than if we had to prefix all global functions, anyway. Something worth considering is that even when using namespaced functions, the shorthand is only available in *exactly the current namespace*, so you're rather likely to be qualifying or importing them anyway. For instance, they might be in a child or neighbouring namespace called "...\functions" or " ...\ utils" or " ...\ streams". Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#101802) next »