W liście Stut z dnia środa, 12 września 2007 15:59: > LAUPRETRE François (P) wrote: > >> From: Stut [mailto:[EMAIL PROTECTED] > >> > >> 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. >
But is that flag really needed? If the code has some naming rules, then those can be used to determine what we're looking for - for example: something - a function SOMETHING - a constant Something - a class ISomething - an interface (although distinguishing between classes and interfaces is not strictly necessary as those are quite similar). So if such distinction is necessary, it can be coded for specific project, using such rules as a hint or as strict rule, depending on needs. -- Paweł Stradomski -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php