Hi Oliver,

Oliver Grätz wrote:
So if one only allows simple namespaces (no nesting), then one can see
that this need to be two namespace constants BUT one has to read the
whole line:

- one colon means simple constants
- three colons: two namespaces constants
- two colons: ERROR, undefined


If there were no nesting, then yes, this could be a solution, but I do allow "nested" namespaces, such as this example:

namespace php:xml{ class SimpleXMLElement{} }
$e = new php:xml:SimpleXMLElement();

My opinion: Throw a parser error for missing third argument and enforce
using parentheses. Not allowing constants in namespaces would mean that
the current PHP core could not be put inside a "PHP" namespace because
(guess what) it contains global constants.


A parse error is already thrown. I wouldn't force using parentheses, as a simple space can be used in this case, as such (notice the space after "bar" is all I added):

$x = $y ? foo:bar :baz:stupid;

OLLi

PS: How about a unicode symbol (egypt god Ra) as namespace operator.
PHP6 will be all about unicode => Yeah, gazillions of new operator
symbols. Or register a "PHP namespace separator symbol" that looks like
the PHP logo. Just kidding...

LOL! If I could only find it on my keyboard...


Regards,

Jessie

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

Reply via email to