Re: namespace separator and whining
| From: | Lukas Kahwe Smith | Date: | Tue, 04 Nov 2008 16:27:17 +0000 |
| Subject: | Re: namespace separator and whining | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41644@lists.php.net to get a copy of this message | ||
On 04.11.2008, at 17:15, Gregory Beaver wrote:
In other words, it is perfectly all right to have a different name resolution for classes than we have for functions and constants because of this different expectation. It is dangerous to fallback for classes prior to autoload, but it is not at all dangerous for functions/constants because the expectation is different.To me the key question is do we want to let people overload global classes easily or are we mostly talking about convinience? Class names are typed quite seldom (and even in a few years down the road the bulk of PHP's features will be provided via functions), so I would not think that we really need to focus on convenience here.
For this reason, the only resolution that we should be considering is: classes: 1) try ns::class 2) autoload ns::class 3) fail functions/constants: 1) try ns::function/ns::const 2) try internal function/const 3) fail. Note that I say "try internal" because the only purpose behind allowing this is to make it easier to use PHP's built-in functionality. Any userspace stuff should be specifically \prefixed or imported via use.I dont think it makes sense to differentiate between internal and non internal functions. I think this is quite hard to grasp, I also do not see the real benefit.
And (yes) we need import for functions.Would be nice to have .. for me the pains for functions/constants have reached the threshold now that I am reviewing the question of resolution. regards, Lukas Kahwe Smith mls@pooteeweet.org