----- Original Message -----
From: "Andi Gutmans" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
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.


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to