Hi!

Ideally someone would summarize the discussion (or maybe two people, one from each "camp") and then we can have a vote. Make it an RFC or

OK, here it goes again:

When we adopt some syntax, especially syntax matching some other language, we do not just introduce an otherwise meaningless sequence of symbols to be learned by users. We introduce concepts, and we create associative links with other languages. So, if we introduced the syntax for namespaces that is used by C++ - i.e. braces, we would imply that it has all the properties that C++ one has and that we encourage the usage patterns that C++ users adopt. Namely, that namespaces can be nested, that they are hierarchical, that namespaces can be used in any place in the file, just for one function/class or even variable without any influence on the surroundings, that using multiple namespaces in the same file, along with global space, is completely OK.

However, the usage that we want to promote in PHP is very different - we want to encourage users to use one namespace per file (except for number of hacks that basically pack multiple logical files into one physical file), that namespace is to encompass big structured pieces of code and not to be used in random in-and-out fashion.

Added to that, braced namespaces would imply additional (and unnecessary) level of hierarchy and indentation for most editors and code formatters. Of course, special exception can be programmed into them to make namespace{} behave in a different way from all other constructs having {} blocks, but this would be working on solving the problem that we ourselves created, quite unnecessarily.

With all that, there's not one thing that syntax with {} enables us to do and that is not possible to do right now (and that we want to do :). Only reason presented for this change is the misguided notion of "consistency", grounded in the belief that semantically different constructs must look the same, because that way they will be... well, "consistent". While similarity in function in many cases should produce similarity in looks, I believe there's substantial semantic difference between namespaces and classes or functions, enough to make them use different syntax, especially when it better fits the function namespaces are to serve in PHP.
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED]   http://www.zend.com/
(408)253-8829   MSN: [EMAIL PROTECTED]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to