Re: [RFC] Treat namespaced names as single token, relax reserved keyword restrictions
| From: | Jakob Givoni | Date: | Thu, 18 Jun 2020 08:04:22 +0000 |
| Subject: | Re: [RFC] Treat namespaced names as single token, relax reserved keyword restrictions | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-110649@lists.php.net to get a copy of this message | ||
On Thu, Jun 18, 2020 at 9:39 AM Nikita Popov <nikita.ppv@gmail.com> wrote:
>
>> In a mail that probably went to everyone's spam folder, I asked for
>> opinions on allowing use of .\Foo as an alternative to Foo in the
>> current namespace, thus reducing friction with reserved keywords even
>> more. Any thoughts on that now?
>
>
> How would .\Foo be different from the currently existing namespace\Foo? (Note that
> "namespace" here is to be taken literally, not as "put the current namespace
> here").
>
I didn't know you could do that! I don't think I've ever seen it used,
maybe because there's been little advantage over just Foo? I guess it
only matters if you also import Foo?
For what it's worth, .\Foo would be significantly shorter than
namespace\Foo and probably more intuitive to understand as well.
Furthermore, if you were to create a namespace called "Namespace"
(don't judge! ;-)), which I would assume would be possible should this
RFC be implemented, we could avoid namespace\Namespace\Foo :-D
Thanks for the feedback, it was just an idea - could be a new RFC some
other day.
Thanks,
Jakob