Hi Dmitry,

it would be great to have namespaces in PHP6, as these always
longer-getting classnames are somewhat annoying.

I don't want to start a discussion about the separator (I think there
was one before), but:

> > 6) Calls to qualified functions are resolved at run-time. Call to
> > "A::B::foo()" first tries to call function foo() from namespace
"A::B", then
> > it tries to find class "A::B (__autoload() it if necessary) and call its
> > static function foo()

If I am not mislead this ambiguity is due to the fact that :: is the
namespace separator? If, so I'd rather suggest changing the separator,
because one could alter the program's behaviour by adding a function
foo() to a namespace thus making PHP call this function instead of the
method. Besides, a lot of less experiences programmers would not be sure
when which function/method is actually called.


> > All class and function names inside are automatically prefixed with
> > namespace name. Inside namespace, local name always takes precedence
over
> > global name. It is possible to use the same namespace in several PHP
files.
> > The namespace declaration statement must be the very first statement in
> > file.

I take it that when I include or conditionally include, the included
file has its own namespace, if one is declared in that file. What if I
do not declare a namespace in an include file? Does this file "inherit"
the current namespace or are the contents added to the global namespace?

> > point of definition down to the end of file. It is recommended
however to
> > place imports at the beginning of the file. Import statements have
effect
> > only on file where they are written.

Could this result in name conflicts when including files that have their
own import statements?


> > 4) calls to unqualified functions that are not defined in current
namespace
> > are resolved in run-time. The call to function foo() inside namespace
(A::B)
> > first tries to find and call function from current namespace
A::B::foo() and
> > if it doesn't exist PHP tries to call internal function foo(). Note that
> > using foo() in namespace you can call only internal PHP functions,
however
> > using ::foo() you are able to call any function from global namespace.

Does this mean that a programmer could "override" an internal PHP
function, possibly accidentally?


Kind regards,

Stefan


-- 
 >e-novative> - We make IT work for you.

 e-novative GmbH - HR: Amtsgericht München HRB 139407
 Sitz: Wolfratshausen - GF: Dipl. Inform. Stefan Priebsch

 http://www.e-novative.de

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

Reply via email to