Re: Re: [RFC] "use global functions/consts" statement
| From: | Nicolas Grekas | Date: | Fri, 24 Jan 2020 16:10:18 +0000 |
| Subject: | Re: Re: [RFC] "use global functions/consts" statement | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108229@lists.php.net to get a copy of this message | ||
> One option that I haven't seem much discussion on is the opposite: Always
> only look in the global namespace. Any unimported unqualified usages will
> be treated as fully qualified names. This would match the proposed
> semantics for functions/consts and change the resolution rules for classes.
> I think this would have relatively little impact on how code is written, as
> classes already tend to make extensive use of cross-namespace references
> and the import is usually IDE managed.
>
Quick reaction: that'd make sense to me!
Adding a "use CurrentNamespace\Foo" or using "namespace\Foo" looks easy
enough to adopt.
Does this mean you're suggesting to use declare(symbol_lookup='global')? Or
shorter: declare(lookup='global'), or maybe even declare(global_lookup=1)
as I'm not sure we need 3 options here?