Hi Marcus,

Marcus Boerger wrote:
Hello Jessie,

  that's only one case,go with consts. now try
$x = $y ? foo:bar:baz:stupid;

now what?

best regards
marcus


Here it'll fail. My patch is basically allowing colons inside the class/function/constant name, so whitespace here is _crucial_, i.e., the following example WOULD work:

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

Notice the space between the middle colon. Here it correctly identifies the constants "foo:bar" and "baz:stupid". In the former case, it interpreted "foo:bar:baz:stupid" and got the semicolon before getting the ternary's colon, so it would produce a syntax error.

This doesn't seem like an actual problem to me though. Even though I somehow managed to your example work, would you really want to accept spaghetti code like this to work? Having proper spacing here is important for clarity, and as a side effect of my patch, I am enforcing this code-cleanness (never thought of this effect before).


Regards,

Jessie

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

Reply via email to