Re: namespace separator and whining
| From: | Lukas Kahwe Smith | Date: | Wed, 05 Nov 2008 19:34:26 +0000 |
| Subject: | Re: namespace separator and whining | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41691@lists.php.net to get a copy of this message | ||
On 05.11.2008, at 01:05, Stanislav Malyshev wrote:
Hi!Well, its not like the person is getting Y when he is expecting X. Both classes have the same name after all, so there is some relation between these two classes. More importantly its the users choice to enable this in __autoload(). As all frameworks got that its the end users job to implement autoload, I would not worry soo much in this case. Just a question: How hard would it be to implement in case we do want this? regards, Lukas Kahwe Smith mls@pooteeweet.orgor in other words give the user the ability to specify when he wants the fallback to global and not doing a fallback to global per default. That wayThis would be quite complex thing since this way you can't be sure which class gets loaded when you say, e.g., Exception - and thus, if you write something like "throw new Exception("XML did not load")" and except My\XML\Parser\Exception and have catch for it but get just Exception your application would happily unroll to the top and fail. I think actually knowing what class is going to be loaded is a good idea and overriding loader behavior so it's asked for one class and loads completely different one is not a good idea. One would expect if he asks for class X he gets class X, not class Y.