Hello Ron,

""Ron Korving"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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:
>

__autoload is not called at the time of import, only when the alias is
actually used, so there are actually no performance issues here.

> 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().
>

Do we really want this? Since there is no performance improvement having
imports be block-scoped, this really is not needed. IMO, it can also create
confusion, as the same alias means different things in different contexts of
the file.


Regards,

Jessie

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

Reply via email to