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
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
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:
-
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).
-
silent collisions between namespaced function and static method in a class with the same name (no errors or anything).
-
different resolution rules for userspace and internal functions.
-
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
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
I would agree with you, I think namespaces should wait for a later version.
Maybe 6 or even later. I believe there are many problems that need to be
sorted be namespaces hit release.
Maybe we could do something like so.
namespace Fully::Qualified::Class::Name class Declaration extends Whatever
implents MyInterface { }
I have reservations in using :: as a resolution operator which can easily
clash with normal class space usage.
Is it too late to have these discussions?? It seems I missed the big
namespace discussions on the mailing list and things have already gone
ahead.
/James
On Sat, May 31, 2008 at 1:51 PM, Stan Vassilev | FM sv_forums@fmethod.com
wrote:
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:
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).silent collisions between namespaced function and static method in a
class with the same name (no errors or anything).different resolution rules for userspace and internal functions.
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 letssurf@gmail.com
To: Stan Vassilev | FM sv_forums@fmethod.com
Cc: internals@lists.php.net
Sent: Saturday, May 31, 2008 3:43 PM
Subject: Re: [PHP-DEV] Alternative to multiple namespaces per filewhat I find really annoying about all this namespace stuff, is how would
that be any different fromclass 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
Hi,
Your suggestion seems ok too, anything is better than no functioning way at all to do it.
Regards,
Stan Vassilev
----- Original Message -----
From: James Dempster
To: Stan Vassilev | FM
Cc: internals@lists.php.net
Sent: Saturday, May 31, 2008 4:02 PM
Subject: Re: [PHP-DEV] Alternative to multiple namespaces per file
I would agree with you, I think namespaces should wait for a later version. Maybe 6 or even later. I believe there are many problems that need to be sorted be namespaces hit release.
Maybe we could do something like so.
namespace Fully::Qualified::Class::Name class Declaration extends Whatever implents MyInterface { }
I have reservations in using :: as a resolution operator which can easily clash with normal class space usage.
Is it too late to have these discussions?? It seems I missed the big namespace discussions on the mailing list and things have already gone ahead.
I would agree with you, I think namespaces should wait for a later version.
Maybe 6 or even later. I believe there are many problems that need to be
sorted be namespaces hit release.Maybe we could do something like so.
namespace Fully::Qualified::Class::Name class Declaration extends Whatever
implents MyInterface { }I have reservations in using :: as a resolution operator which can easily
clash with normal class space usage.Is it too late to have these discussions?? It seems I missed the big
namespace discussions on the mailing list and things have already gone
ahead./James
Unfortunately it probably is. I recall someone did raise the
ClassName::staticMethod() vs. Namespace::function() collision problem months
ago, and the response at the time was "Pfft, like who uses classes and
functions in the same project, anyway?"
(Of course, the answer is "well I do" but I've long since learned that such
answers don't carry much weight around here, so I mostly just read to see
where the language is going rather than to influence it. So I've just
resigned myself to not being able to use namespaces in PHP.)
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
On Sat, May 31, 2008 at 6:01 PM, Larry Garfield larry@garfieldtech.com
wrote:
I would agree with you, I think namespaces should wait for a later
version.
Maybe 6 or even later. I believe there are many problems that need to be
sorted be namespaces hit release.Maybe we could do something like so.
namespace Fully::Qualified::Class::Name class Declaration extends
Whatever
implents MyInterface { }I have reservations in using :: as a resolution operator which can easily
clash with normal class space usage.Is it too late to have these discussions?? It seems I missed the big
namespace discussions on the mailing list and things have already gone
ahead./James
Unfortunately it probably is. I recall someone did raise the
ClassName::staticMethod() vs. Namespace::function() collision problem
months
ago, and the response at the time was "Pfft, like who uses classes and
functions in the same project, anyway?"(Of course, the answer is "well I do" but I've long since learned that such
answers don't carry much weight around here, so I mostly just read to see
where the language is going rather than to influence it. So I've just
resigned myself to not being able to use namespaces in PHP.)
It's things like this that make me worry about the future of PHP. The elite
few pushing out lots of developers. :(
If namespaces are going to be problematic then lets wait for version 6.
It would also give more time for namespaces to be thought out properly.
I feel that namespaces in it's current form is a half arsed attempt to force
something into the language.
--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the
possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson--
/James
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:
- 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).
...
To which I would add: namespaces are not for variables, this I would like to see.
--
Alain Williams
Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
Chairman of UKUUG: http://www.ukuug.org/
#include <std_disclaimer.h
Hi!
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.
The thing is there already were discussions. And I don't see how
discussing endlessly but not doing anything is going to make things better.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Hi,
I'm a user-space developer. And while indeed not doing anything is annoying
enough that I've started learning the internals of PHP, I'm not at the point
where I can confidently submit namespace patches myself. And let's face it,
they'll be ignored.
I would think those with the "karma" and the confidence they know better
than the community who's vote they override all the time, would do anything,
but ... :) ?
Regards,
Stan Vassilev
Hi!
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.The thing is there already were discussions. And I don't see how
discussing endlessly but not doing anything is going to make things
better.Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com