Hello Johannes,

Monday, March 3, 2008, 12:40:52 PM, you wrote:

> Hi Fredrik,

> On Fri, 2008-02-29 at 16:02 +0100,
> "=?ISO-8859-1?Q?Fredrik_Holmstr=F6m?=" wrote:
>> Basicly, the call is this: Demo::Functions::test(); where both Demo
>> and Functions are namespaces, and test() is a function inside the
>> Demo::Functions namespace. If you have an autoload handler here and
>> the file containing the Demo::Function::test()-decleration isn't
>> loaded, autoload will be called.
>> 
>> Now everything seems fine, but the problem is that when the autoload
>> hooks have all fired php looks for the class Demo::Function, because
>> autoload seems to be interpreting the Demo::Function::test(); call as:
>> <Namespace>::<Class>::<Function>, when it should be
>> <Namespace>::<Namespace>::<Function>, and since the Function class
>> doesn't exist it will trigger a fatal error.

> autoload was designed for loading classes not functions. Wen resolving
> Demo::Function::test() and no function having that name is being found
> it's assumed that Demo is the namespace, function a class name in there
> and test a static method call. There's no way for the engine to see what
> else might be meant. So the result is expected and changing it woud mean
> to do major changes wich just creates new problems.

Actually we can (I think). There are to possibilities:

new namespace::class()
new namaespace::namedspace::class()

and so on, or:

namespace::class::functoin()
namespace::function()

and so on. That is, when detecting braces after it and a new in front
than it is a class. If there is no new in front it must be a function and
autoload needs to be called for all but the last part. With new it needs
to be called for all parts. Since the compiler already knows whether it
generates a ctor call we must have an issue that should be fixable.


Best regards,
 Marcus


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

Reply via email to