Lukas Smith schrieb:
> Oliver Grätz wrote:
> 
> 
>>one absolutely needs to use namespaces inside the ternary. As such cases
>>will be pretty rare, this is no big drawback. The good thing: no
>>whitespace magic is needed!
> 
> 
> so you replace the need for whitespace magic with the need for 
> parentheses? you do notice you are running in circles?

Nope. Parentheses are a totally different thing here. Adding mandatory
whitespace means giving syntactic meaning to something that normally
never should have it. Meaningful whitespace is really evil. On the other
side parentheses are already there. They are an existing concept of
scoping evaluation. The idea simply consists of not having namespaces
inside the ternary:

- Read the "?":
  turn off T_WHITESPACE
- "(" and ")":
  reactivate between these
    (a marker 'whitespace was off before "("' is needed)
- ":":
  do nothing
- end of ternary (")" or ";" or something I might have forgotten):
  reactivate T_WHITESPACE

Thisd is also very easy to remember since the rule to learn is:
Namespaces don't exist where they can't. And with the ":", there is only
one such place.

OLLi

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

Reply via email to