Re: Re: [RFC] Namespace syntax decision
| From: | Paul Chandler | Date: | Wed, 26 Mar 2008 06:35:39 +0000 |
| Subject: | Re: Re: [RFC] Namespace syntax decision | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-36527@lists.php.net to get a copy of this message | ||
Can't both (brackets and non) be supported? I have some sick people in my own company that would LOVE if they could embed multiple namespaces in the same file. In circles around my own cubicle, engineers prefer to write one class per namespace, per file, as God intended. Various Perl, Python & C influences have made some developers think differently about code separation.
Can "namespace" exist as both a statement and a bracketed keyword? Obviously, the documentation should encourage best practices, so proper separation would be a primary topic... but accommodation for my "alternative" engineers would also be available.
p
On Mar 25, 2008, at 11:12 PM, Andi Gutmans wrote:
In general I'd prefer one namespace per-file, at least as a best practice and common advertised use. For this case it doesn't really matter too much whether it's with or without brackets. My preference is without because then you just stick it at the top and don't have an extra level of indentation which you'd typically have with brackets. For the not recommended case where you want to combine multiple files with a tool I still prefer without brackets. The brackets again add indentation and in addition, it's not really clear whether you can put code in between namespaces definitions (between closing "}" and "namespaces" keyword). You shouldn't be able to and without brackets that becomes much more clear because current namespace is relevant until the next namespace declaration; thus never allowing a "gap". I think it's important for people to consider the former reasons as I think without {} will lead be more intuitive and will lead to less indentation. I definitely prefer "namespace" as a keyword. My 2 cents. Andi-----Original Message----- From: Gregory Beaver [mailto:greg@chiaraquartet.net] Sent: Friday, March 21, 2008 3:01 PM To: Marcus Boerger Cc: internals@lists.php.net Subject: [PHP-DEV] Re: [RFC] Namespace syntax decision Marcus Boerger wrote:hereHello Internals, we all were asked to stop discussing syntax of namespaces as wewere toldthat we would decide after the namespace functionality was fullyimplemented.Now I think that the functionallity is pretty much settled we should revisit the syntax. We all have been very patient so far. Anywaygoesourmy take on it: PHP is very close to Java and C++ in terms of Syntax. And many ofusersexceptare familiar with one or even both of them. Also we have a tendencytoespecially take syntax from those two or be in line with those two languages. That said I see two ways: 1) namespace foo { }This is acceptable if nothing can exist outside namespace foo {}declare and other namespace declarations.-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php2) package foo; I favor 1) if we allow namespace nesting and 2) if not. The currentway ofnesting is very confusing: namespace foo; namespace bar;I prefer this syntax because it discourages multiple namespaces, but still allows them (nesting is an inaccurate term in this case, I strongly encourage not using it) Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php