Ken Stanley wrote: > > > On Dec 11, 2007 6:13 PM, Gregory Beaver <[EMAIL PROTECTED] > <mailto:[EMAIL PROTECTED]>> wrote: > > The example above shows that imported names are reset at each > namespace > declaration. There is no prohibition on this code: > > <?php > namespace one; { > use Blah::A; > // code > } > namespace two; { > use Foo::A; > // code > } > ?> > > Users who wish to use brackets may do so. The performance penalty > imposed by using brackets is minor for some cases, and for users > who are > following the recommended practice of 1 namespace per file, the > syntax > is ideal. > > My question is that if using the above code already incurs a perf > penalty, then why not just go ahead and include true support for > braces in namespaces. Unless there is an additional penalty that I'm > missing, the only difference between true braces and the above is that > the above looks like a cheap hack (note: the use the of phrase "cheap > hack" is in no way meant to demean the hard work of the people > involved with the namespace implementation, and is the sole opinion of > the poster :)). Because the performance penalty is unnecessary, just use 1 namespace per file for your code. Those who need to combine files are not doing it for maintenance reasons.
Just to be clear, this code does *not* have a performance penalty: <?php namespace one; use Blah::A; //code namespace two; use Foo::A; // code ?> Any brackets adds another set of shift/reduce to the parser, regardless of how the syntax of the language is defined. Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php