Re: Alternative to multiple namespaces per file
| From: | Stan Vassilev | FM | Date: | Sat, 31 May 2008 12:51:25 +0000 |
| Subject: | Re: Alternative to multiple namespaces per file | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-38022@lists.php.net to get a copy of this message | ||
Hi,
The community wanted namespaces. This is not exactly the namespaces it wanted, but since
they're going in, I think the best course of action is to solve the big obvious problems so
they are at least usable and extendable in future versions of PHP.
If you have to ask *me* personally, I'd not put namespaces in 5.3 and have a big discussion
about the entire implementation. But alas.
I think those "showstopper" problems with namespaces are:
1) one namespace per file (look at frameworks like Symphony which compile their classes together for
performance, they will never be able to switch to, or support namespaces).
2) silent collisions between namespaced function and static method in a class with the same name (no
errors or anything).
3) different resolution rules for userspace and internal functions.
4) subtly different resolution rules for functions/classes/constants
So I'm trying to to address 1) in this thread.
Regards,
Stan Vassilev
----- Original Message -----
From: James Dempster
To: Stan Vassilev | FM
Cc: internals@lists.php.net
Sent: Saturday, May 31, 2008 3:43 PM
Subject: Re: [PHP-DEV] Alternative to multiple namespaces per file
what I find really annoying about all this namespace stuff, is how would that be any different
from
class Fully_Qualified_Class_Name_Declaration { }
/James
On Sat, May 31, 2008 at 1:10 PM, Stan Vassilev | FM <sv_forums@fmethod.com> wrote:
Hi,
I suppose this has been discussed before, so I'll not repeat reasons unless requested, but
I just want to offer a possible feature to mitigate the impact of "one namespace per
file", which doesn't have controversial syntax and hopefully less difficulties in the
implementation:
class Fully::Qualified::Class::Name::Declaration { .... }
same as:
namespace Fully::Qualified::Class::Name;
class Declaration { .... }
... except of course this allows classes of different namespaces to be declared in one file.
Most namespace-enabled languages consider the above declarations equivalent. Share your opinions.
Regards,
Stan Vassilev