Re: namespace issues

From: Date: Fri, 26 Sep 2008 19:24:44 +0000
Subject: Re: namespace issues
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-40709@lists.php.net to get a copy of this message
Hi, On Mon, 2008-09-22 at 12:45 -0700, Stanislav Malyshev wrote: > 1. Allow braces for namespaces. So, the syntax for namespaces will be: > a) namespace foo; > should be first (non-comment) statement in the file, namespace extends > to the end of the file or next namespace declaration. > b) namespace foo {} > can appear anywhere on the top scope (can not be nested). > Mixing both syntaxes in one file is not possible. The semantics of both > syntaxes will be identical. I'm fine with that, personally I'd like having only the {}-Syntax but as many people want both, well, ... For future times (6.0) we might think about adding nesting support - if we get it working good with the engine, but no show-stopper, we're "delayed" enough... > 2. Simplify resolution order for classes in the namespace: unqualified > names are resolved this way: > a) check "use" list if the name was defined at "use", follow that > resolution > b) if not, the name resolves to namespace::name > Consequence of this will be that for using internal class inside > namespace one would need to refer to it either as ::Foo or do use ::Foo > prior to its usage. That will hurt a bit when working with DOM for example, but still +1. > 3. Functions will not be allowed inside namespaces. We arrived to > conclusion that they are much more trouble than they're worth, and > summarily we would be better off without them. Most of the functionality > could be easily achieved using static class methods, and the rest may be > emulated with variable function names, etc. That's fine, I'm not sure about constants, neither one way nor the other, but in general I see some support for dropping them. johannes

« previous php.internals (#40709) next »