Ionut Gabriel Stan wrote:

<snip>

> echo Test::foo(); // outputs namespace function
> echo '<br>';
> echo ::Test::foo(); // outputs namespace function

<snip>

> My questions are:
> 
> 1. How should I call the static method foo in the global class Test (except 
> for call_user_func)
> 2. How should I call the static method baz of class Bar in namespace Test 
> with call_user_func
> 3. Is there no possibility to change your minds and replace the double colon 
> with something else, likes a simple colon? I find it very confusing to figure 
> out what is what and the way I should call it.

Hi Ionut,

Stas did a good job of answering how to call the static method using
call_user_func.  The answer to #1 under the current implementation is
"you can't" which is why I posted a patch to allow differentiating
between the two earlier this week.

However, I have since discovered a much better solution, and have a
working patch, but am checking details offlist before I propose it, as
it involves a slight but important change to namespace syntax.  Stay
tuned for further details.  As for your 3rd question, I guarantee this
will not happen, as it is technically impossible to do.  For instance:

switch ($something) {
        case oops:
                is:this:part:of:oops();
                break;
}

The above code could resolve to either "case oops:" followed by
"is:this:part:of:oops()" or as "case oops:is:this:part:of:oops()" and
there is no way for a computer to tell the difference without
introducing required whitespace.  Since PHP != Python, that won't happen :).

Greg

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

Reply via email to