Re: [Zend Engine 2] namespaces ambiguity

From: Date: Mon, 01 Oct 2001 01:04:06 +0000
Subject: Re: [Zend Engine 2] namespaces ambiguity
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-66884@lists.php.net to get a copy of this message
----- Original Message ----- From: "Andi Gutmans" <andi@zend.com> To: <php-dev@lists.php.net>; <engine2@lists.zend.com> Sent: Sunday, September 30, 2001 12.31pm Subject: [Zend Engine 2] namespaces ambiguity > Would this mean that the person meant $test?(FOO):(BAR:BARBARA) or > $test?(FOO:BAR):BARBARA? I guess I'm confused about the ambiguity here. ':' isn't a legal character in the name of a constant, right? So "BAR:BARBARA" wouldn't legally be the name of a constant -- only a constant 'BARBARA' in the namespace 'FOO'. So then "FOO:BAR:BARBARA" would be the constant "BARBARA" in the nested namespace "FOO:BAR". Perhaps the ambiguity is because this string is in double-quotes? Then it could be made unambiguous like this: "{$test}?{FOO:BAR:BARBARA}". This way, the parser could recognize the namespaced constant as opposed to the string. (I'm not sure of the details of using constants in strings -- I've always referred to them outside any quotes with the string concatenation operator. Like: $test . '?' . BARBARA -- but) It only seems logical to extend the "unambiguating" curly-braces to constants inside any construct where variable/constant expansion is necessary. In ambiguous times, I would like to see PHP give an "ambiguity" error -- or a parse error. Or perhaps for backwards compatibility, the parser should assume that inside double-quoted strings/heredocs that ':' has no special meaning unless inside curly braces where variable expansion takes place. Anyway, if I'm not seeing the real ambiguity here, let me know. Dean Hall.

« previous php.dev (#66884) next »