Re: RE : [PHP-DEV] RE : Namespaces and __autoload()

From: Date: Wed, 12 Sep 2007 13:59:10 +0000
Subject: Re: RE : [PHP-DEV] RE : Namespaces and __autoload()
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-32292@lists.php.net to get a copy of this message
LAUPRETRE François (P) wrote:
From: Stut [mailto:stuttle@gmail.com] This would need to come from the user implementation of __autoload through naming conventions or a lookup table. PHP does not get involved with resolving a type to a filename, and rightly so.
The question is not to have PHP get involved in the symbol to filename correspondance. I have a lookup table, but the requested type must come from the interpreter context and, if the autoload handler does not get it, it cannot know what type to look for in its lookup table. Unfortunately, even if not very common, a function and a class can have the same name. In this case, there will be two entries in the lookup table. If I don't know which type is requested, I can only search all known types. Maybe it would be enough but it wouldn't be elegant nor efficient, especially if we extend the mechanism to functions and constants.
I agree that if the autoload mechanism were extended to functions and constants (which I am opposed to, not that anyone will care) there would need to be a type provided to __autoload so it knew what it was looking for. However, this surely doesn't apply to classes and interfaces since the interpreter has no way of knowing and no reason to care what a particular symbol is since the two are interchangeable. -Stut -- http://stut.net/

« previous php.internals (#32292) next »