On Namespaces...

php.internals

Manuel Vázquez Acosta

22 years ago
[Is this the right news?] Recently I downloaded PHP 5.0.0 and read the RFCs, I sadly noticed that a Namespace proposal was declined. Why? I've been using PHP for many years and I've found problems when trying to "glue" several third parties codes. PEAR has come with a not-quite-nice solution to this problem (e.g: class HTTP_Request), and it works just fine; but I still think namespace would help a lot. I know there may be namespaces clashes, but it's far easier to replace just a line of code - i.e the namespace decl; instead of having to replace each clashing symbol all over the scripts. Manu.

Zeev Suraski

22 years ago
Please read the archives! Zeev At 18:55 15/08/2004, Manuel Vázquez Acosta wrote:

Justin Hannus

22 years ago
Zeev, I too have been searching the archives for subjects on 'namespace' and found allot of back and forth opinions on it but not a real summary about its conclusion. Basically, I have allot of code at work still in php4 that that uses it own class importing mechanism than just include|require[_once] dubbed 'Namespace' with static method Namespace::import(). I'm just wondering if 'namespace' and 'import' is reserved for future use before I port all my code to php5. Thanks, -Justin Hannus "Zeev Suraski" <zeev@zend.com> wrote in message news:5.1.0.14.2.20040815190344.04cd6160@localhost... Please read the archives! Zeev At 18:55 15/08/2004, Manuel Vázquez Acosta wrote:
>[Is this the right news?] > >Recently I downloaded PHP 5.0.0 and read the RFCs, I sadly noticed that a >Namespace proposal was declined. Why? I've been using PHP for many years
and

Marcus Börger

22 years ago
Hello Justin, Monday, August 16, 2004, 4:08:46 PM, you wrote:
> Zeev,
> I too have been searching the archives for subjects on 'namespace' and found > allot of back and forth opinions on it but not a real summary about its > conclusion. Basically, I have allot of code at work still in php4 that that > uses it own class importing mechanism than just include|require[_once] > dubbed 'Namespace' with static method Namespace::import(). I'm just > wondering if 'namespace' and 'import' is reserved for future use before I > port all my code to php5.
There's a good chance that later PHP versions (maybe 5.2 or 6 or whatever) have something like namespaces or packages which require at least the keyword 'import'. That's an example for the reason i never use names that are used as keywords in other languages. regards marcus

Justin Hannus

22 years ago
Thanks. I figured as much but when I implemented this the terms 'Namespace' and 'import' just sounded so sexy to me. -Justin "Marcus Boerger" <helly@php.net> wrote in message news:441357908.20040816200641@marcus-boerger.de...
> Hello Justin, > > Monday, August 16, 2004, 4:08:46 PM, you wrote: > > > Zeev, > > > I too have been searching the archives for subjects on 'namespace' and
found
> > allot of back and forth opinions on it but not a real summary about its > > conclusion. Basically, I have allot of code at work still in php4 that
that
> > uses it own class importing mechanism than just include|require[_once] > > dubbed 'Namespace' with static method Namespace::import(). I'm just > > wondering if 'namespace' and 'import' is reserved for future use before
I

Manuel Vázquez Acosta

22 years ago
> There's a good chance that later PHP versions (maybe 5.2 or 6 or whatever) > have something like namespaces or packages which require at least the > keyword 'import'. That's an example for the reason i never use names that > are used as keywords in other languages. >
That sounds like good news! Thanks a lot. BTW, I did spent hours searching the archives for the namespace discussion; I found a lot of XML namespace stuff and a little bit talking about packages (Java-like packages). Regards, Manu.

Zeev Suraski

22 years ago
At 21:06 16/08/2004, Marcus Boerger wrote:
>Hello Justin, > >Monday, August 16, 2004, 4:08:46 PM, you wrote: > > > Zeev, > > > I too have been searching the archives for subjects on 'namespace' and > found > > allot of back and forth opinions on it but not a real summary about its > > conclusion. Basically, I have allot of code at work still in php4 that that > > uses it own class importing mechanism than just include|require[_once] > > dubbed 'Namespace' with static method Namespace::import(). I'm just > > wondering if 'namespace' and 'import' is reserved for future use before I > > port all my code to php5. > >There's a good chance that later PHP versions (maybe 5.2 or 6 or whatever) >have something like namespaces or packages which require at least the >keyword 'import'. That's an example for the reason i never use names that >are used as keywords in other languages.
FWIW, I have no idea what Marcus is talking about :) The reasons that brought us to remove namespaces in the first place are conceptual, so I don't see how it could change in the future, but that's just my 2c :) Justin - unfortunately you'd have to read quite a few threads on the mailing list (the engine2 one) in order to understand why namespaces were removed, because unlike most 'standard' problems, this one is mostly conceptual, rather than technical. The short version of the story is that 'import' was perceived as something very different by different people - and it appeared to only be useful if implemented in a way that completely contradicts the 'spirit' of PHP (i.e., it's inconsistent with the way include/require behave, for instance). A good (albeit long) thread to start with would be http://www.zend.com/lists/engine2/200304/msg00164.html. Zeev

Justin Hannus

22 years ago
> I don't see how it could change in the future, but that's > just my 2c :)
Thanks, thats all I was really looking for. The status of the terms, cause if they're not being reserved then I would like to continue using them -- at my own risk. As Marcus points out, its might not be the best idea to implement function/classes with keyword names from other languages but the terms best describe my problem. Maybe I'll prefix them. EOT -Justin "Zeev Suraski" <zeev@zend.com> wrote in message news:5.1.0.14.2.20040817184242.04cd02f0@localhost...
> At 21:06 16/08/2004, Marcus Boerger wrote: > >Hello Justin, > > > >Monday, August 16, 2004, 4:08:46 PM, you wrote: > > > > > Zeev, > > > > > I too have been searching the archives for subjects on 'namespace' and > > found > > > allot of back and forth opinions on it but not a real summary about
its
> > > conclusion. Basically, I have allot of code at work still in php4 that
that
> > > uses it own class importing mechanism than just include|require[_once] > > > dubbed 'Namespace' with static method Namespace::import(). I'm just > > > wondering if 'namespace' and 'import' is reserved for future use
before I
> > > port all my code to php5. > > > >There's a good chance that later PHP versions (maybe 5.2 or 6 or
whatever)

Al Baker

22 years ago
I would just like to echo some concerns on namespaces. I've pioneered the adoption of PHP in some enterprise development groups at Avaya, and it's been adopted on the merits of the fastest and easiest tool for web interface development. Every now and then someone duplicates a class name and mutters about the apparent weakness in the language. Though after some explanation, it's not too big of a deal and just noted as a quirk of the language by developers. However, for those not dealing with the language directly it can leave a lasting impression that PHP is not quite "enterprise ready." I know there are ways to be clever with PHP to create excellent and complex enterprise grade applications. I also have read and acknowledge the various issues of ambiguity in syntax and scope that namespaces introduced. However, namespaces (and probably an overhaul of include/require behavior) to be more Java-like would go a long way in further adoption of PHP in enterprise applications. I think Andi once called namespaces programming sugar, well some sugar is good for promoting the language as well as for tranisitioning developers who have a sugar addiction :) Regards, Al On Tue, 2004-08-17 at 12:06 -0400, Justin Hannus wrote: