I assume ::: is being used because it simply works and the discussion on 
which seperator to use might still go on for some time ;). You have a point 
about import statements being allowed only in the beginning. This would be 
nice:

class X
{
  public function foo()
  {
    import class bar:::MyClass;
    $obj = new MyClass();
    $obj->doSomething();
  }
}

This would be nice, because __autoload() only needs to be called if my 
method foo() is being called. bar:::MyClass is not a dependency for the 
whole file, but only for X::foo(). Performance-wise it would be a good thing 
if importing namespaces would not extend the dependency to the whole file. 
Also, it could prevent unnecessary aliasing:

class X
{
  public function foo()
  {
    import class bar:::MyClass;
    $obj = new MyClass();
    $obj->doSomething();
  }

  public function fubar()
  {
    import class bla:::MyClass;
    $obj = new MyClass();
    $obj->doSomething();
  }
}

In this example, bar:::MyClass and bla:::MyClass are used. Two different 
classes, each in their own namespace. Aliasing is not required, because the 
imported namespaces are limited to the scope of the methods foo() and 
fubar().

- Ron





"Marian Kostadinov" <[EMAIL PROTECTED]> schreef in bericht 
news:[EMAIL PROTECTED]
First I must say - a nice job:)
The namespaced version works fine.
I found just 3 problems (things I don't like):

1.Import statements are allowed only in the beginning of the script.
2.Global function calls are not allowed in a namespace.
3.The example below does not work.

<?
import class ABC:::TEST as ABC_TEST;
import function ABC:::FUNC;

namespace ABC {
class TEST {}
function FUNC() {
new TEST;
}
}
FUNC();
?>

Anyway, the patch seems to be stable.
Also ::: is veeery long. I wrote it a lot of times and usually I got
:: instead of ::: 

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

Reply via email to