Stan Vassilev | FM wrote:
> <?php
> // global, scope 1
>
> namespace { // global, scope 2 }
>
> // global, scope 1
>
> namespace { // global, scope 3 }
>
> // global, scope 1
>
> namespace foo\bar { // foo\bar, scope 4 }
>
> // global, scope 1
> ?>
I am afraid I must shed my generally congenial public nature to express
a strong opinion:
This is a horribly complex idea Stan. PHP's implementation of
namespaces do not define scope. Once we open that Pandora's box, there
is no turning back.
Big time -1 from me.
Remember, the patch I'm proposing would only be necessary for people
using un-namespaced code combined with namespaced code (already a bad
idea) *and* scattering "use" statements throughout the global code.
Also, the *only* supported use case behind allowing multiple namespaces
per file is to allow people to mash pre-existing separate PHP files
together, and have them still compile. Requiring brackets is designed
to make it more readable, and the "use" restriction furthers that goal.
I would have implemented this requiring all code to be encased in
namespace {} or namespace nsname {}, but that turned out to be virtually
impossible in the parser because of the need to also allow "declare"
statements outside namespace declarations
Thanks,
Greg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php