473,804 Members | 3,649 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Namespaces in PHP5, removed?

Hi All,

I read in a forum somewhere that namespaces, though once supposed to be a
part of PHP5, have been removed. Is this true? Can anyone show me the
official statement by Zend that they decided to forget about namespaces?
Why would they do this?

I could really use namespaces. If they canned this idea, that is quite a
disappointment :-/ Guess you cannot win them all.

-Josh
Jul 17 '05 #1
14 2326
With total disregard for any kind of safety measures "Joshua
Beall" <jb****@donotsp am.remove.me.he raldic.us> leapt forth and
uttered:
Hi All,

I read in a forum somewhere that namespaces, though once
supposed to be a part of PHP5, have been removed. Is this true?
Can anyone show me the official statement by Zend that they
decided to forget about namespaces? Why would they do this?


From the Zend changelog:

Version 5.0.0 Beta 2
30-Oct-2003
Lots and lots of changes in the Zend Engine 2 since beta 1:
* Removed the not so working namespaces support

I've lost the links to the original reasonings given by Andi
Gutmans and Zeev Suraski, but heres one link:

http://www.sitepoint.com/forums/show...5&postcount=34
--
Phil Roberts | Nobody In Particular | http://www.flatnet.net/
Jul 17 '05 #2
Because it was pretty pointless that way it was implemented. You can't
import names from a namespace, so everytime you use something from within
it, you have to tag on the namespace identifier.

Uzytkownik "Joshua Beall" <jb****@donotsp am.remove.me.he raldic.us> napisal w
wiadomosci news:iG******** **********@nwrd dc01.gnilink.ne t...
Hi All,

I read in a forum somewhere that namespaces, though once supposed to be a
part of PHP5, have been removed. Is this true? Can anyone show me the
official statement by Zend that they decided to forget about namespaces?
Why would they do this?

I could really use namespaces. If they canned this idea, that is quite a
disappointment :-/ Guess you cannot win them all.

-Josh

Jul 17 '05 #3
"Chung Leong" <ch***********@ hotmail.com> wrote in message
news:ZY******** ************@co mcast.com...
Because it was pretty pointless that way it was implemented. You can't
import names from a namespace, so everytime you use something from within
it, you have to tag on the namespace identifier.


That's too bad. I wonder, how well can I emulate namespaces using nested
classes? Is there any way to "import" the contents of a class?
Jul 17 '05 #4
Joshua Beall wrote:
Hi All,

I read in a forum somewhere that namespaces, though once supposed to
be a part of PHP5, have been removed. Is this true? Can anyone show
me the official statement by Zend that they decided to forget about
namespaces? Why would they do this?


Quote from http://www.php.net/ChangeLog-5.php (version 5.0.0 beta 2,
30-Oct-2003):

"Removed the not so working namespaces support"

I don't know why exactly, but I have a feeling the developers wanted to
focus on other parts of PHP 5 instead.
JW

Jul 17 '05 #5
Personally, I never liked namespace. Its need is understandable in C++,
where you link in binary libraries and there's no other workaround for name
collisions. With PHP you can just rename the class/function. And namespace
promotes bloated class libraries, which affects runtime performance in PHP.
When the number of classes is large enough where name collision is an issue,
you scripts are probably all crawling.

Uzytkownik "Joshua Beall" <jb****@donotsp am.remove.me.he raldic.us> napisal w
wiadomosci news:kL******** **********@nwrd dc02.gnilink.ne t...
"Chung Leong" <ch***********@ hotmail.com> wrote in message
news:ZY******** ************@co mcast.com...
Because it was pretty pointless that way it was implemented. You can't
import names from a namespace, so everytime you use something from within it, you have to tag on the namespace identifier.


That's too bad. I wonder, how well can I emulate namespaces using nested
classes? Is there any way to "import" the contents of a class?

Jul 17 '05 #6
Chung Leong writes:
Personally, I never liked namespace. Its need is understandable in C++,
where you link in binary libraries and there's no other workaround for name
collisions. With PHP you can just rename the class/function.
You mean search and replace for every occurance of the duplicate
class? It's feasible, but not always very practical, and you need to
know that a name collision exists to begin with. The best practical
alternative to namespaces is a class naming convention, and that has
its own problems.
And namespace promotes bloated class libraries, which affects
runtime performance in PHP. When the number of classes is large
enough where name collision is an issue, you scripts are probably
all crawling.


Only if you include them all at once. You could have a vast library
of classes available, but only include the ones you need as you need
them. Or leave it to the optimiser to cache your classes. For PHP to
be taken seriously as an enterprise programming language, it must be
possible to write large systems in it. Namespaces make large systems
easier to write.

Apart from name collision prevention, namespaces also provide another
scope for class member access. Classes in the same namespace can
access each others members, but deny access to classes outside the
namespace. Without namespaces you must declare such members public
and hope for the best.

--

__o Alex Farran
_`\<,_ Analyst / Programmer
(_)/ (_) www.alexfarran.com

Jul 17 '05 #7
Being a incorrigible PHP Maoist, I say down with class hierarchy and screw
private variable.

Long live the global scope!

Uzytkownik "Alex Farran" <al**@alexfarra n.com> napisal w wiadomosci
news:m3******** ****@alexfarran .com...
Chung Leong writes:
Personally, I never liked namespace. Its need is understandable in C++,
where you link in binary libraries and there's no other workaround for name collisions. With PHP you can just rename the class/function.


You mean search and replace for every occurance of the duplicate
class? It's feasible, but not always very practical, and you need to
know that a name collision exists to begin with. The best practical
alternative to namespaces is a class naming convention, and that has
its own problems.
And namespace promotes bloated class libraries, which affects
runtime performance in PHP. When the number of classes is large
enough where name collision is an issue, you scripts are probably
all crawling.


Only if you include them all at once. You could have a vast library
of classes available, but only include the ones you need as you need
them. Or leave it to the optimiser to cache your classes. For PHP to
be taken seriously as an enterprise programming language, it must be
possible to write large systems in it. Namespaces make large systems
easier to write.

Apart from name collision prevention, namespaces also provide another
scope for class member access. Classes in the same namespace can
access each others members, but deny access to classes outside the
namespace. Without namespaces you must declare such members public
and hope for the best.

--

__o Alex Farran
_`\<,_ Analyst / Programmer
(_)/ (_) www.alexfarran.com

Jul 17 '05 #8
Alex Farran <al**@alexfarra n.com> wrote or quoted:
For PHP to be taken seriously as an enterprise programming language, it
must be possible to write large systems in it. Namespaces make large
systems easier to write.


Yes - exactly.

Still - PHP has some other problems - as a result of being hastily hacked
together - I can imagine why the developers might want to focus on those ;-)
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #9

"Alex Farran" <al**@alexfarra n.com> wrote in message
news:m3******** ****@alexfarran .com...
Chung Leong writes:
Personally, I never liked namespace. Its need is understandable in C++,
where you link in binary libraries and there's no other workaround for name collisions. With PHP you can just rename the class/function.
You mean search and replace for every occurance of the duplicate
class? It's feasible, but not always very practical, and you need to
know that a name collision exists to begin with. The best practical
alternative to namespaces is a class naming convention, and that has
its own problems.


Naming conventions require intelligence, which sadly is in short supply.
And namespace promotes bloated class libraries, which affects
runtime performance in PHP. When the number of classes is large
enough where name collision is an issue, you scripts are probably
all crawling.


Only if you include them all at once. You could have a vast library
of classes available, but only include the ones you need as you need
them. Or leave it to the optimiser to cache your classes. For PHP to
be taken seriously as an enterprise programming language, it must be
possible to write large systems in it. Namespaces make large systems
easier to write.


I have wriitten large systems in several languages which did not have
namespaces, so namespaces cannot be the only solution to that problem
(whatever the "problem" is). If you identified the problem correctly, then
perhaps a solution other than namespaces would present itself.

Tony Marston
http://www.tonymarston.net/
Apart from name collision prevention, namespaces also provide another
scope for class member access. Classes in the same namespace can
access each others members, but deny access to classes outside the
namespace. Without namespaces you must declare such members public
and hope for the best.

--

__o Alex Farran
_`\<,_ Analyst / Programmer
(_)/ (_) www.alexfarran.com

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4759
by: Spidah | last post by:
Looking at the list of changes made in PHP5 one of them is "Removed the bundled MySQL client library" Does anyone know exactly what this means? I assume we will still be able to code for MySQL as we do now? Thanks Hamilton
28
3658
by: mikel | last post by:
Hello, php5 is in everybodies mouth - but what are the *real* advantages and plus' compared to php4? mikel
4
5838
by: badbetty | last post by:
Dear Googlers I have installed PHP5 to run on WinXP against Apache 2. It works! ie. I have tested a few simple scripts and a basic xml document parse. I now want to try the XSL extension so I can transform xml docs. Having copied the php_xsl.dll to a directory where it can be found and done the uncommenting in php.ini, it still will not work. The script I
4
1829
by: Daniel Andersen | last post by:
Hey, We are in the process of rewriting our internal management system (which was written in PHP4), and figured this would be a good time to migrate to PHP5 to get all the OO goodness it has to offer :) I am running php 5.0.3 on apache 1.3.something under slackware linux. Unfortunately I frequently get segfaults from php scripts, and they are not even scripts that do anything fancy or special. For example, in one script i got a...
1
1275
by: Noah Coad [MVP .NET/C#] | last post by:
Something is stange is happening in my 'Class View'. First of all, it doesn't show all the classes in each namespace in my project. I have over 50 classes in one project and only 6 show up. Besides that, when I first load the solution, all the namespaces show correctly. After I click on one or two namespaces in the 'Class View', all the namespaces go to lowercase in the 'Class View' display. What's up with this? -Noah Coad
5
2165
by: Aziz | last post by:
Hi, I've recently contacted technical service of a web hosting company and asked them wheter or not they're gonna upgrade to PHP5 and MySQL5. Here's a quote from their response which confused me a little: "As php5 and mysql5 are still beta versions we don't install beta versions on production servers due to secure reasons, we install only current working versions on production servers"
9
5266
by: java | last post by:
Hey there, I just removed an elderly PHP4-Installation from my Windows-Box and installed PHP 5.2.1. I used the PHP4-Module as local batchfile- interpreter by E:\ersDHCP>php ./extractLog.php which was perfectly alright and worked well. But now PHP5 fails to run the same script without any modification!
3
3271
by: rorni | last post by:
Hi, I'm porting code from Windows to HP-UX 11, compiling with g++. I'm getting a compilation error on the system's debug.h include file, which is included very indirectly through a series of other system include files. The one I am including is <map> . The errors I am getting are: /opt/hp-gcc-4.2.1/lib/gcc/ia64-hp-hpux11.23/4.2.1/../../../../include/c++/4.2.1/debug/debug.h: At global scope:...
14
1726
by: Jeff | last post by:
I'm working on a server that is running PHP4. I'd like to upgrade this so I can use the PHP5 code I have already. What kind, if any, problems will I have with the existing PHP code base? I see: Local Master
0
9704
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9569
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9130
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6844
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5503
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.