Re: Simple Namespace Proposal

From: Date: Mon, 16 Jul 2007 16:34:26 +0000
Subject: Re: Simple Namespace Proposal
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-30987@lists.php.net to get a copy of this message
a) I was talking about namespace name "A_B" not class/function name.
_ is legal identifier character, so it would not be a good idea to use it as a separator. :: on the other side is natural scope separator in many languages. But I'm rather reluctant to start the "my separator is better than yours" thread for the 42th time :)
b) So as far as I understand "import" doesn't actually *import* names from specified namespace to the current one but just renames long namespace name to a shorter one. And if I get it right the separator in the namespace name is allowed and required only to express default name when importing without "as". Am I right?
Not exactly. It does import, but not names just one name - the very same name it has as an argument. The :: is used to join components of the name. Note that you can also do: import Foo::XML as myXML; $a = new myXML::Data::Document(); if you wish so. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#30987) next »