Re: Re: Global namespace?
| From: | Marcus Boerger | Date: | Tue, 11 Sep 2007 15:26:23 +0000 |
| Subject: | Re: Re: Global namespace? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-32260@lists.php.net to get a copy of this message | ||
Hello emo,
Tuesday, September 11, 2007, 4:50:01 PM, you wrote:
> I believe I read somewhere that it will look like this:
> ::class_b->method_c();
This is the preferred way as it doesn't introduce a new keyword. Also this
is inline with other languages.
> for accessing global scope.
> Regards,
> Emil Ivanov
> Richard Quadling wrote:
>> Assume for some reason you have an entity in a namespace which has the
>> same name as something in the global namespace.
>>
>> Within the namespace, you wouldn't need to use the namespace prefix
>> (maybe it has been aliased, subclassed or some other reference).
>>
>> How would you access the global namespaced entity?
>>
>> For variables, object instances, references, etc., you can use
>> $GLOBALS[], but if the namespace is going to look like ...
>>
>> namespace_a::class_b->method_c();
>>
>> Should there be an alias for global?
>>
>> global::class_b->method_c();
>>
>> Or have I missed something?
>>
Best regards,
Marcus