Lupus Michaelis wrote:
> Larry Garfield a écrit :
> 
>> I agree that #5 seems like the best solution.  The problem is caused
>> by the double meaning of ::.  All of the other solutions feel like
>> bandaids.  
> 
> 
>   They are not a double meaning : it is a scope resolver. Like in C++.
> So please all stop this war about namespaces, and look where it was
> resolved in other languages. It will be wisely :)

Hi,

Amazingly enough, this work has already been done.  The first thing
noticed is that C++ is a compiling language, and PHP isn't.  Therefore
at compile time, it is possible to know every single file that will be
available, every single class, and so on.  This enables all kinds of
clever resolution such as importing ns::* and it actually works with
full performance.

PHP, on the other hand, is a dynamic language, and it is impossible to
know in advance which files, which classes, which namespaces will be
defined.  Other dynamic languages that have implemented namespaces have
solved the problems mentioned via run-time resolution, which is much slower.

One key difference from C++ is that namespaces do *not* define scope in
PHP.  The only constructs that define scope different from global scope
are functions and now closures (as I understand them from reading the
mailing list).

I suppose I should have mentioned option #6: do all class, function and
constant resolution at run-time, "obsoleting" all opcode caches and make
PHP 5.3 an unusable release for any high traffic websites.

Greg

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

Reply via email to