Re: namespaces and alpha3
| From: | Derick Rethans | Date: | Wed, 15 Oct 2008 07:04:38 +0000 |
| Subject: | Re: namespaces and alpha3 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-41046@lists.php.net to get a copy of this message | ||
On Fri, 10 Oct 2008, Lukas Kahwe Smith wrote:
> At this point I guess we have the choice between:
>
> 1) rip them out
> 2) status quo
> 3) Stas proposal
> 4) Dmitrys proposal
>
> Again I hope that Stas/Dmitry will give us an insight about their proposals,
> though Stas proposal might or might not see any changes.
Stas wrote up an RFC about the two proposals:
http://wiki.php.net/rfc/namespaceref
Now I finally figured out what the two things are without having to real
a gazillion pointless posts it makes it easier to formulate my point of
view.
It seems that we're not quite 100% how we want to do things. Reading the
"Namespaces with functions/constants" part of Stas' RFC makes me
cringe... just changing the behavior of -> and :: to just make things
work is a cludge, and a bad one at that. The other part, "Namespaces
without functions/constants" is a much more practical solution. However,
a third one might be to use a syntax separator that we've not seen at
all yet (I'd say ':::').
Even with the "No functions/constants" option
I've issues, because of the resolving of internal classes. In a
namespace using "new className" they would resolve to
nameSpace::className. Having to use ::className to get to an internal
class is yet another cludge. IMO the internal classes should be able to
use with the "::" and should have precedence over namespace'd classes
with the same name. If you really want to re-use an internal class name,
use "namespace::className". I realize that that means you need to
have at least two "elements" of the namespace'd class while using them.
However, while reading code it makes it absolutely clear whether you're
using an internal class or not.
As we're getting really close to 5.3, I would suggest to remove
namespaces from this release as we're simply not done with even agreeing
on how things should work. PHP 5.3 has many other cool things, and
leaving namespaces for PHP 6 means we're actually introducing
functionality there as well (for the folks that don't care about
Unicode). We've done with namespaces for a loooong time, and they've
never really been *required*. Many people won't be able to use it any
way as they have to support older PHP versions in their code base as
well. PHP 6 is a much more natural switch for something like this.
If we *absolutely *have* to* have namespaces, then we should go with the
"Namespaces without functions/constants" proposal, with some tweaks.
However, I still think it's not ready enough to put even that into 5.3.
regards,
Derick
--
HEAD before 5_3!: http://tinyurl.com/6d2esb
http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org