-------- Original Message --------
Subject: Re: [PHP-DEV] Renaming namespaces to packages
Date: Fri, 10 Aug 2007 10:03:25 -0700
From: Stanislav Malyshev stas@zend.com
Organization: Zend Technologies
To: Keryx Web webmaster@keryx.se
References: 001401c7db45$feeb0530$6e02a8c0@thinkpad
alpine.DEB.0.98.0708101411550.8736@kossu.ez.no
46BC927B.8070402@zend.com 46BC9778.5080406@keryx.se
FWIW. I teach PHP and for most students I believe their other
implementation of namespaces will soon be the one in ECMAScript
4/JavaScript 2.
Thanks for mentioning it! From what I can see, their idea of namespaces
is radically different from what C++ is doing and equally different from
what packages are anywhere. They basically introduce an orthogonal
namespacing plane (or we can call it attribute set that can be applied
to any name) which can be operated independently of the main namespace.
It's interesting and can be a powerful tool but I imaging how
mind-boggling would be the code seriously using that capability.
And they, btw, are not ashamed of calling it namespaces just because
it's not c++ ;)
From what I gather it looks a lot like this one for PHP, and packages
in JS 2 is something more different.
http://developer.mozilla.org/presentations/xtech2006/javascript/
The packages there, however, seem very much like Java ones with addition
of braces.
P.S. I see you didn't send that to the list - will it be OK to forward
it and my response there? I think it's interesting contribution to the
discussion.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev skrev:
And they, btw, are not ashamed of calling it namespaces just because
it's not c++ ;)
Exactly. That was my main point. And, as I said,ECMAScript 4 will most
probably be the main other language for most ordinary PHP developers,
not Java and certainly not C. Especially the newbie ones!
From a pedagogic point of view I'd say "namespaces" is the better name.
Lars Gunther
Stanislav Malyshev skrev:
And they, btw, are not ashamed of calling it namespaces just because
it's not c++ ;)Exactly. That was my main point. And, as I said,ECMAScript 4 will most
probably be the main other language for most ordinary PHP developers,
not Java and certainly not C. Especially the newbie ones!From a pedagogic point of view I'd say "namespaces" is the better name.
Lars Gunther
Uhh, ECMAScript??
I do program a lot in Java/C# (and others) a lot, and I don't think it
would be good to confuse people with the same name for something
different.
Tijnema
Stanislav Malyshev skrev:
And they, btw, are not ashamed of calling it namespaces just because
it's not c++ ;)Exactly. That was my main point. And, as I said,ECMAScript 4 will most
probably be the main other language for most ordinary PHP developers,
not Java and certainly not C. Especially the newbie ones!From a pedagogic point of view I'd say "namespaces" is the better name.
Lars Gunther
Uhh, ECMAScript??
ECMAScript is the formal name for what most people call Javascript.
Technically Javascript is the Mozilla implementation of ECMAScript and
JScript is the MS implementation. 70% of the world just calls
it "Javascript", and 29% calls it "Ajax" because they don't know any
better. :-)
I believe the original point is that for most PHP programmers their other main
languages will be Javascript and SQL, not C++ or C#, so if the goal is to use
a name that's predictable for someone coming from another language we should
assume Javascript as that other language, not Java or C#.
--
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
Stanislav Malyshev skrev:
And they, btw, are not ashamed of calling it namespaces just because
it's not c++ ;)Exactly. That was my main point. And, as I said,ECMAScript 4 will most
probably be the main other language for most ordinary PHP developers,
not Java and certainly not C. Especially the newbie ones!From a pedagogic point of view I'd say "namespaces" is the better name.
Lars Gunther
Uhh, ECMAScript??
ECMAScript is the formal name for what most people call Javascript.
Technically Javascript is the Mozilla implementation of ECMAScript and
JScript is the MS implementation. 70% of the world just calls
it "Javascript", and 29% calls it "Ajax" because they don't know any
better. :-)
Thanks for the explanation ;-)
I believe the original point is that for most PHP programmers their other main
languages will be Javascript and SQL, not C++ or C#, so if the goal is to use
a name that's predictable for someone coming from another language we should
assume Javascript as that other language, not Java or C#.--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012
There's also a quite large group that is coming from ASP.NET right?
ASP.NET has C#-style namespaces, and that will get a lot of confusion
I think.
And for uers coming from perl, there's a perl extensions that enables
C++-style namespaces, and that's also different.
Since JavaScript (or ECMAScript) doesn't have namespaces, people that
hear the name namespace for php will either don't know what it is, or
think that it's the same as the C implementation.
Tijnema
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
Since JavaScript (or ECMAScript) doesn't have namespaces, people that
hear the name namespace for php will either don't know what it is, or
think that it's the same as the C implementation.Tijnema
I don't know what namespaces look like in other langs, but the idea of
a "namespace" is common to many languages and promoting encapsulation
to stop adding things to the global namespace is common also.
namespace works very well for what it does (as I see it).
--
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
It isn't C++-like namespaces and it isn't Java-like packages. So it
doesn't really matters what name will be used. It will confuse
newcomers from any language anyway.
I came to PHP from C++ and I find my self confused from time to time
even though I code in PHP for a few years now. There are already more
then one thing in named just the same as in C++ but implemented
differently. One more thing woun't change anything.
FWIW, I vote for namespace
.
BTW, if we are talking about the names already I have a question. Why
import
? Why not use
? AFAIK it's reserved and not used for anything
and IMHO it's better pair for namespace
.
Regards,
Giedrius
Tijnema skrev:
Since JavaScript (or ECMAScript) doesn't have namespaces, people that
hear the name namespace for php will either don't know what it is, or
think that it's the same as the C implementation.
ECMAScript 3 aka JavaScript 1.x does not have NS.
ECMAScript 4 aka JavaScript 2 will have NS.
Why do I think that most newbies - for whom the naem we use care the
most! - will not come from C++, C#, Java or anything else. Because
having taught PHP to newbies for quite some time now I clearly see that
PHP is their first or second language, and the other one is JS.
"I wan to make a web page" Off to learn HTML and (in a good world
standards and CSS)
"I want to have a contact form/discussion board/news/blog" Tada! Enter PHP!
"I want some cool animation". Enter JavaScript.
In a good world they will be taught secure PHP programming, unobtrusive
DOM-scripting, etc. Mostly they won't, but the name "namespace" makes a
lot more sense in trying to explain the purpose, and would make my job
easier.
Lars Gunther
Hello Larry,
even if their other main language is JS - they still do not have namespaces
or packages and even if both languages have something. I'd rather confuse
people that only know two languages which are very different anyways than
confusing the probably much bigger group of people that know C++ and Java as
well. Remember that C++ and Java together are still responsible for around
50% of all code written nowadays.
marcus
Monday, August 13, 2007, 3:35:04 PM, you wrote:
Stanislav Malyshev skrev:
And they, btw, are not ashamed of calling it namespaces just because
it's not c++ ;)Exactly. That was my main point. And, as I said,ECMAScript 4 will most
probably be the main other language for most ordinary PHP developers,
not Java and certainly not C. Especially the newbie ones!From a pedagogic point of view I'd say "namespaces" is the better name.
Lars Gunther
Uhh, ECMAScript??
ECMAScript is the formal name for what most people call Javascript.
Technically Javascript is the Mozilla implementation of ECMAScript and
JScript is the MS implementation. 70% of the world just calls
it "Javascript", and 29% calls it "Ajax" because they don't know any
better. :-)
I believe the original point is that for most PHP programmers their other main
languages will be Javascript and SQL, not C++ or C#, so if the goal is to use
a name that's predictable for someone coming from another language we should
assume Javascript as that other language, not Java or C#.
--
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
Best regards,
Marcus
The two pages for reference.
http://developer.mozilla.org/es4/spec/chapter_11_packages.html
http://developer.mozilla.org/es4/spec/chapter_12_namespaces.html
The spec's quite nice, although a bit of a nightmare to implement in
parts ;) -
From what I've seen, and I've not been keeping up with all the posts -
PHP's implementation looks a bit more like Javascript packages.
Regards
Alan
Keryx Web wrote:
Stanislav Malyshev skrev:
And they, btw, are not ashamed of calling it namespaces just because
it's not c++ ;)Exactly. That was my main point. And, as I said,ECMAScript 4 will most
probably be the main other language for most ordinary PHP developers,
not Java and certainly not C. Especially the newbie ones!From a pedagogic point of view I'd say "namespaces" is the better name.
Lars Gunther
Hello Stanislav,
JS has not much in common with PHP so it shouldn't be used as just another
language to steal ideas from. Actually we are speaking of an OO feature here
and when it comes to that than the two are very different. PHP on the one
hand uses class based OO (like C++ and Java) while JS uses prototype based
OO. And anyway, are we struggling to find excuses here? Can we in no way
ever at least try to be consistent in anything we do? That JS argument is an
extremly bad far fetched argument.
marcus
Saturday, August 11, 2007, 9:57:37 PM, you wrote:
-------- Original Message --------
Subject: Re: [PHP-DEV] Renaming namespaces to packages
Date: Fri, 10 Aug 2007 10:03:25 -0700
From: Stanislav Malyshev stas@zend.com
Organization: Zend Technologies
To: Keryx Web webmaster@keryx.se
References: 001401c7db45$feeb0530$6e02a8c0@thinkpad
alpine.DEB.0.98.0708101411550.8736@kossu.ez.no
46BC927B.8070402@zend.com 46BC9778.5080406@keryx.se
FWIW. I teach PHP and for most students I believe their other
implementation of namespaces will soon be the one in ECMAScript
4/JavaScript 2.
Thanks for mentioning it! From what I can see, their idea of namespaces
is radically different from what C++ is doing and equally different from
what packages are anywhere. They basically introduce an orthogonal
namespacing plane (or we can call it attribute set that can be applied
to any name) which can be operated independently of the main namespace.
It's interesting and can be a powerful tool but I imaging how
mind-boggling would be the code seriously using that capability.
And they, btw, are not ashamed of calling it namespaces just because
it's not c++
From what I gather it looks a lot like this one for PHP, and packages
in JS 2 is something more different.
http://developer.mozilla.org/presentations/xtech2006/javascript/
The packages there, however, seem very much like Java ones with addition
of braces.
P.S. I see you didn't send that to the list - will it be OK to forward
it and my response there? I think it's interesting contribution to the
discussion.Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Best regards,
Marcus
I am not the one that want to put more fire in this entire
discussion... I'm tired of listening (this is like package or like
namespace or because my students like it or even that PHP has a unique
implementation).
I've read all comments and I think I can give my 2 cents.
Instead of keep talking about namespace or package, enlist feature
that both have to deal and how PHP solve it. The PHP behaves more like
package or namespace in this feature? Count all the winners and the
major is the result that everybody is expecting.
Let me point examples...
Subject: File Struture
Comments:
Namespace do not restrict directories (AFAIK)
Packages restrict directories (each package have a directory with its
name, like Zend/Cache/File.php)
Question: What is the behavior of PHP in this situation?
PHP restricts the directory, just like packages. So,
Zend/Cache/File.php is the package Zend::Cache and has the class named
File
Winner: package
Multiple namespaces/packages in one file:
....
Make a list, define how PHP deals with any situation and the count
winner is the answer for the so discussed question.
Regards,
Hello Stanislav,
JS has not much in common with PHP so it shouldn't be used as just another
language to steal ideas from. Actually we are speaking of an OO feature here
and when it comes to that than the two are very different. PHP on the one
hand uses class based OO (like C++ and Java) while JS uses prototype based
OO. And anyway, are we struggling to find excuses here? Can we in no way
ever at least try to be consistent in anything we do? That JS argument is an
extremly bad far fetched argument.marcus
Saturday, August 11, 2007, 9:57:37 PM, you wrote:
-------- Original Message --------
Subject: Re: [PHP-DEV] Renaming namespaces to packages
Date: Fri, 10 Aug 2007 10:03:25 -0700
From: Stanislav Malyshev stas@zend.com
Organization: Zend Technologies
To: Keryx Web webmaster@keryx.se
References: 001401c7db45$feeb0530$6e02a8c0@thinkpad
alpine.DEB.0.98.0708101411550.8736@kossu.ez.no
46BC927B.8070402@zend.com 46BC9778.5080406@keryx.seFWIW. I teach PHP and for most students I believe their other
implementation of namespaces will soon be the one in ECMAScript
4/JavaScript 2.Thanks for mentioning it! From what I can see, their idea of namespaces
is radically different from what C++ is doing and equally different from
what packages are anywhere. They basically introduce an orthogonal
namespacing plane (or we can call it attribute set that can be applied
to any name) which can be operated independently of the main namespace.
It's interesting and can be a powerful tool but I imaging how
mind-boggling would be the code seriously using that capability.And they, btw, are not ashamed of calling it namespaces just because
it's not c++From what I gather it looks a lot like this one for PHP, and packages
in JS 2 is something more different.
http://developer.mozilla.org/presentations/xtech2006/javascript/The packages there, however, seem very much like Java ones with addition
of braces.P.S. I see you didn't send that to the list - will it be OK to forward
it and my response there? I think it's interesting contribution to the
discussion.Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.comBest regards,
Marcus--
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco@hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil
I am not the one that want to put more fire in this entire
discussion... I'm tired of listening (this is like package or like
namespace or because my students like it or even that PHP has a unique
implementation).I've read all comments and I think I can give my 2 cents.
Instead of keep talking about namespace or package, enlist feature
that both have to deal and how PHP solve it. The PHP behaves more like
package or namespace in this feature? Count all the winners and the
major is the result that everybody is expecting.Let me point examples...
Subject: File Struture
Comments:
Namespace do not restrict directories (AFAIK)
Packages restrict directories (each package have a directory with its
name, like Zend/Cache/File.php)Question: What is the behavior of PHP in this situation?
PHP restricts the directory, just like packages. So,
Zend/Cache/File.php is the package Zend::Cache and has the class named
FileWinner: package
Multiple namespaces/packages in one file:
....Make a list, define how PHP deals with any situation and the count
winner is the answer for the so discussed question.Regards,
Hello Stanislav,
JS has not much in common with PHP so it shouldn't be used as just another
language to steal ideas from. Actually we are speaking of an OO feature here
and when it comes to that than the two are very different. PHP on the one
hand uses class based OO (like C++ and Java) while JS uses prototype based
OO. And anyway, are we struggling to find excuses here? Can we in no way
ever at least try to be consistent in anything we do? That JS argument is an
extremly bad far fetched argument.marcus
Saturday, August 11, 2007, 9:57:37 PM, you wrote:
-------- Original Message --------
Subject: Re: [PHP-DEV] Renaming namespaces to packages
Date: Fri, 10 Aug 2007 10:03:25 -0700
From: Stanislav Malyshev stas@zend.com
Organization: Zend Technologies
To: Keryx Web webmaster@keryx.se
References: 001401c7db45$feeb0530$6e02a8c0@thinkpad
alpine.DEB.0.98.0708101411550.8736@kossu.ez.no
46BC927B.8070402@zend.com 46BC9778.5080406@keryx.seFWIW. I teach PHP and for most students I believe their other
implementation of namespaces will soon be the one in ECMAScript
4/JavaScript 2.Thanks for mentioning it! From what I can see, their idea of namespaces
is radically different from what C++ is doing and equally different from
what packages are anywhere. They basically introduce an orthogonal
namespacing plane (or we can call it attribute set that can be applied
to any name) which can be operated independently of the main namespace.
It's interesting and can be a powerful tool but I imaging how
mind-boggling would be the code seriously using that capability.And they, btw, are not ashamed of calling it namespaces just because
it's not c++From what I gather it looks a lot like this one for PHP, and packages
in JS 2 is something more different.
http://developer.mozilla.org/presentations/xtech2006/javascript/The packages there, however, seem very much like Java ones with addition
of braces.P.S. I see you didn't send that to the list - will it be OK to forward
it and my response there? I think it's interesting contribution to the
discussion.Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.comBest regards,
Marcus--
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco@hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil
Short and sweet.
Here's a test, anyone.. write up an example of a python package, a
java package, a c++ namespace and c# namespace. Then show us how to
use them and it should be clear enough on what we have in PHP.
I'll make the first part:
C#:
--File: csNamespace.cs (The namespace code extended example))--
namespace NameOne
{
namespace HierarchicalNamespace
{
namespace SomeOtherName
{
public class SayHi
{
public string sayHi()
{
System.Console.WriteLine('Hi..');
}
}
}
}
}
--File: csUtil.cs (Invoking the NS)--
using NameOne.HierarchicalNamespace.SomeOtherName;
c++:
--File: cppNamespace.lh (The namespace code)--
namespace NameTwo
{
namespace AnotherHierarchyNamespace
{
int someInt;
}
class SomeClass
{
}
}
--File: cppUtil.cpp (Invoking the NS)--
#include "cppNamespace.lh"
namespace SomeAlias = NameTwo::AnotherHierarchyNamespace;
Python:
--File: nameUtil.py--
def showName(name): # method that outputs the name ...
print name
--File: output.py--
import nameUtil
nameUtil.showName('david')
or
from nameUtil import showName
showName('david')
Java:
--File: namespace.java (The package code)--
package namespace;
public class IamAClass
{
public static void main(String[] args)
{
System.out.println("Hello namespace?");
}
}
--File: javaUtil.java--
import namespace.*;
Go, unleash hell of comments! :)
and yes the current implementation does behave a bit more like java
and even looks similar to java, now it's only a matter of marketing
right ? Do we go with what people know and how they do it already or
we go our way ?
People from C++ will be confused as they will if they do java, but
people from java will be less (and there's a lot of students learning
java) confused. Whereas if we go our way, we will confuse both the
java'ers and the cpp'ers and the csharp'ers.
So now everyone gave their opinions, it's time to find solution. If no
one agrees on the name, why don't we make a normal poll ? Overwhelming
? Very.. but hey, the name is a big decision that will affect the
usage, reputation, and education of our users/developers meaning that
anyone who used some namespaces or packages in their way will need
some education or re-education, and we might need to tend towards a
name that is closer to something that already exists instead of using
a name only for marketing purposes that is not really the meaning of
an existing technology.
Anyhow, let's get this thread back in line and not talk about
ECMAscript (one can open a thread for that) and try to get this
resolved quick ? Sounds good ?
We've got namespaces in, and a patch already made for packages, now
only time to take a decision, I propose that the next emails only
contain the word ('namespace', 'package') and an explanation of why
they think it would be better for the future of PHP but no arguments,
only answers. That way, we'll have a clean list of answers about what
people think and why that we can keep compile for future references
when people ask why we did not choose the other choice.
Thanks,
D
FWIW I am for "namespaces" because:
- the functionality mentioned most often as missing in PHP is
'namespaces'. People want 'namespaces' (see
http://en.wikipedia.org/wiki/PHP#Criticism) - What they really want is no more clashing
classes/functions/variables when they integrate third party apps
(which the patch provides) - What they also want is no more clashing objects/functions when a new
PHP extension becomes installed by default (Date anyone?) (which the
patch provides) - PHP convention is one class-per-file, ergo, following convention
would mean braces are not required anyway. - Dmitri gets the kudos for introducing PHPs most asked for feature,
instead of 'packages' which no one has asked for. - The patch introduces naming spaces. at a per-file level.
- Packages suggests a connection between folder structure and file
contents of which there is none.
Purely from a PR point of view, 'namespaces' is going to be a winner
amongst users and 90% of people will wish for a braces implementation,
while 'packages' is likely to generate more demands for something
called 'namespaces'
Marc Gear
Marc,
This is not the right reason for naming it namespace.
Example:
Say I am writing a new language. I want to introduce something similar
to functions. But since OO is popular and sounds nice.. why not call
it method on an object?
People are asking for objects.. I'll just give them objects.
It's not about the popularity of a word, but the meaning of it. If it
resembles more of a package, let's call it package (as it does
currently, namespace should be nested.. but that's my opinion).
Regards,
Olivier
FWIW I am for "namespaces" because:
- the functionality mentioned most often as missing in PHP is
'namespaces'. People want 'namespaces' (see
http://en.wikipedia.org/wiki/PHP#Criticism)- What they really want is no more clashing
classes/functions/variables when they integrate third party apps
(which the patch provides)- What they also want is no more clashing objects/functions when a new
PHP extension becomes installed by default (Date anyone?) (which the
patch provides)- PHP convention is one class-per-file, ergo, following convention
would mean braces are not required anyway.- Dmitri gets the kudos for introducing PHPs most asked for feature,
instead of 'packages' which no one has asked for.- The patch introduces naming spaces. at a per-file level.
- Packages suggests a connection between folder structure and file
contents of which there is none.Purely from a PR point of view, 'namespaces' is going to be a winner
amongst users and 90% of people will wish for a braces implementation,
while 'packages' is likely to generate more demands for something
called 'namespaces'Marc Gear
It's not about the popularity of a word, but the meaning of it.
A package means a collection of related classes and thats not whats
happening- it is a scoping level for a particular file. A namespace
is a scope which groups related identifiers. Classes have their own
namespaces, as do functions. This is adding a namespace to a file,
rather than the whole file being executed in global scope (which is
obviously what currently happens)
--
Marc Gear
marcgear@gmail.com
It's not about the popularity of a word, but the meaning of it. If it
resembles more of a package, let's call it package (as it does
Could you give definition of what is a package, so we could see if it
resembles more of a package or less?
currently, namespace should be nested.. but that's my opinion).
Namespace is a mechanism to create separate contexts ("spaces") in which
same names could co-exist without being confused with each other.
Nothing says it should be hierarchical or have any specific properties
like that. BTW, if you read about Java, even though the keyword used in
Java is "package", the functionality is often called "namespace".
Quoting Wikipedia again: "In the Java programming language, the idea of
a namespace is embodied in Java packages." and "Unlike C++, namespaces
in Java are not hierarchical". This is understandable - saying "package"
does not invoke any specific concept, while "namespace" does. If we tell
"PHP now has packages" it can mean anything. If we say "PHP now has
namespaces" virtually everybody would instantly understand what we talk
about. We could, of course, say "PHP now has namespaces which are called
packages" - but wouldn't it sound, well, weird?
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stan,
Sorry to disappoint you, but your idea is wrong.
If PHP team release in the news:
PHP has namespace support!
OR
PHP has package support!
Everyone will understand what does that mean. Those that do not
understand are the ones that had never worked with it and can work in
the future (and will have enough time to know what a package is).
Regards,
It's not about the popularity of a word, but the meaning of it. If it
resembles more of a package, let's call it package (as it doesCould you give definition of what is a package, so we could see if it
resembles more of a package or less?currently, namespace should be nested.. but that's my opinion).
Namespace is a mechanism to create separate contexts ("spaces") in which
same names could co-exist without being confused with each other.
Nothing says it should be hierarchical or have any specific properties
like that. BTW, if you read about Java, even though the keyword used in
Java is "package", the functionality is often called "namespace".
Quoting Wikipedia again: "In the Java programming language, the idea of
a namespace is embodied in Java packages." and "Unlike C++, namespaces
in Java are not hierarchical". This is understandable - saying "package"
does not invoke any specific concept, while "namespace" does. If we tell
"PHP now has packages" it can mean anything. If we say "PHP now has
namespaces" virtually everybody would instantly understand what we talk
about. We could, of course, say "PHP now has namespaces which are called
packages" - but wouldn't it sound, well, weird?Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com--
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco@hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil
If PHP team release in the news:
PHP has namespace support!
OR
PHP has package support!Everyone will understand what does that mean. Those that do not
I wouldn't. And that's not because I'm so dense, but because "package"
could mean anything, from next generation autoloader (I myself proposed
such concept a while ago, and others did too) to integrating PHAR
support into core.
understand are the ones that had never worked with it and can work in
Or worked with different ones enough to understand that "packages" is
used for a zillion of different things, while namespace is quite
well-defined concept. I quoted the wikipedia a number of times, let me
quote it once again:
http://en.wikipedia.org/wiki/Java_package
"A Java package is a mechanism for organizing Java classes into namespaces."
Now let you find a quote which says "A C++ namespace is a mechanism of
organizing C++ code into packages". I bet you won't find it - because
people explain un-obvious concepts in terms of more obvious ones, and
namespace is more obvious than package.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev wrote:
If PHP team release in the news:
PHP has namespace support!
OR
PHP has package support!
PHP has namespaced package support.
Which, is what the implementation is.
Or worked with different ones enough to understand that "packages" is
used for a zillion of different things, while namespace is quite
well-defined concept. I quoted the wikipedia a number of times, let me
quote it once again:
Wikipedia also define the term MVC. But alas, that is a conceptual
definition, not blueprints for implementation.
The fact of the matter is that when it comes down to implementation,
some elements of what we have might fit into both the realm of
namespaces and packages. But the general taste this will leave in
peoples mouthes is package, even if it is a Grapple.
C# is the most intuitive implementation of namespace I have seen to
date. I vote +1 on moving in that direction. Unfortunately, the
current implementation doesn't have braces; this (consequently) adds a
FILE restriction into the "namespace" feature. The moment that FILE
restriction was entered into the game, it started to taste, look, and
feel more like a package paradigm, than a pure namespace paradigm.
Also, considering that limitation placed into namespace, we can be sure
that the most common usage senario for said feature will look like
building library "packages". Point in case is how the ZF has used a
pesudo-namespace-ing class name to accomplish the very same thing.
Ideally, we call this packages now, and implement the C# style
namespaces in the future ;) But I am certain thats a statement/concept
worth flaming.
+1 on package, it makes the most sense regardless of the marketing draw
of "namespace" support.
-ralph
PHP has namespaced package support.
Yep, that's what I was talking about. "We have namespaces but we call it
packages because Java does". Eek.
Wikipedia also define the term MVC. But alas, that is a conceptual
definition, not blueprints for implementation.
Who cares about the implementation? It's still MVC. So let's implement
MVC and call it "distributed enterprise messaging" and then let's spend
next 2 years explaining that it was really MVC that we meant.
namespaces and packages. But the general taste this will leave in
peoples mouthes is package, even if it is a Grapple.
I am still waiting to know what is package? I know what is namespace -
and I for everybody that doesn't know I can explain it in 2 minutes with
one hand tied behind my back. But what is "package"?
current implementation doesn't have braces; this (consequently) adds a
Ouch, not braces again. What is it with braces that you need them so
badly? Many languages aren't using the things ever, isn't it a proof
that there's life outside braces? ;)
library "packages". Point in case is how the ZF has used a
pesudo-namespace-ing class name to accomplish the very same thing.
ZF is using Very_Very_Long_And_Very_Irritating_Class_Names because
there's no choice to do otherwise. That's why we wrote namespaces - to
provide this choice.
+1 on package, it makes the most sense regardless of the marketing draw
of "namespace" support.
Please re-read my mail on perception. "Marketing" here is just a way to
say "perception" so it sounds bad to some people for some reason.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
PHP has namespaced package support.
Yep, that's what I was talking about. "We have namespaces but we call it
packages because Java does". Eek.
Take a look at this URL and tell me which one PHP does look like:
http://kaistizen.net/Project/CSharpJava/csharp_java.htm#NamespaceVsPackage
Wikipedia also define the term MVC. But alas, that is a conceptual
definition, not blueprints for implementation.Who cares about the implementation? It's still MVC. So let's implement
MVC and call it "distributed enterprise messaging" and then let's spend
next 2 years explaining that it was really MVC that we meant.namespaces and packages. But the general taste this will leave in
peoples mouthes is package, even if it is a Grapple.I am still waiting to know what is package? I know what is namespace -
and I for everybody that doesn't know I can explain it in 2 minutes with
one hand tied behind my back. But what is "package"?
From Portuguese Brazilian Wikipedia: http://pt.wikipedia.org/wiki/Package
Translated to you....
One package is a group of classes and interfaces related.
In computers' area, package is a general purpose mechanism to organize
elements in groups. For example, a package java.io which holds all the
classes, in Java programming language, that handles with data
input/output.
Advantages: Easy to find and use the classes; Prevent conflicts in
respect to names (MY note: literal translation); access control;
The programmers must group in packages the classes and interfaces
correlated; The classes and platforms that make part of JAVA platform
are members of various packages. To create a package, you can only put
an interface and one class inside a package.
current implementation doesn't have braces; this (consequently) adds a
Ouch, not braces again. What is it with braces that you need them so
badly? Many languages aren't using the things ever, isn't it a proof
that there's life outside braces? ;)
Braces should only be used if you try to follow the scope idea I
already mentioned. But this is part of namespace paradigm.
library "packages". Point in case is how the ZF has used a
pesudo-namespace-ing class name to accomplish the very same thing.ZF is using Very_Very_Long_And_Very_Irritating_Class_Names because
there's no choice to do otherwise. That's why we wrote namespaces - to
provide this choice.
If you are creating this patch only to simplify this, I recommend you
to keep it as PHP is currently and just add namespace/package support
with a serious implementation.
+1 on package, it makes the most sense regardless of the marketing draw
of "namespace" support.Please re-read my mail on perception. "Marketing" here is just a way to
say "perception" so it sounds bad to some people for some reason.
All you told until now in favor of namespaces are marketing related.
Just read your previous messages.
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Best regards,
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco@hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil
ZF is using Very_Very_Long_And_Very_Irritating_Class_Names because
there's no choice to do otherwise.
If you are creating this patch only to simplify this, I recommend you
to keep it as PHP is currently and just add namespace/package support
with a serious implementation.
Dont be absurd. All namespaces are is a way of avoiding having to use
Very_Very_Long_And_Very_Irritating_Names. Its why we have separate
scope (namespaces) for functions and classes.
--
Marc Gear
marcgear@gmail.com
ZF is using Very_Very_Long_And_Very_Irritating_Class_Names because
there's no choice to do otherwise.
If you are creating this patch only to simplify this, I recommend you
to keep it as PHP is currently and just add namespace/package support
with a serious implementation.Dont be absurd. All namespaces are is a way of avoiding having to use
Very_Very_Long_And_Very_Irritating_Names. Its why we have separate
scope (namespaces) for functions and classes.
I apologize. I wrote one thing imagining another one.
My bad. =)
--
Marc Gear
marcgear@gmail.com
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco@hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil
Take a look at this URL and tell me which one PHP does look like:
http://kaistizen.net/Project/CSharpJava/csharp_java.htm#NamespaceVsPackage
Neither, actually. But it's not about "should we imitate C# or Java".
It's about what's best for PHP. My opinion is that for PHP would be best
to have namespaces and not packages.
From Portuguese Brazilian Wikipedia: http://pt.wikipedia.org/wiki/Package
Translated to you....
In English, it says:
A software package is a bundle of one or several files that either are
necessary for the execution of a computer program, or add features for a
program already installed on the computer or network of computers.
All you told until now in favor of namespaces are marketing related.
Just read your previous messages.
OK, let's see - what is "marketing"? If it's "a set of efforts aimed at
promoting better understanding and wider usage of PHP language" than I
don't see how it can be bad and how it is not important to consider.
If it's "an evil conspiracy of suit-wearing aliens to subvert PHP
community to serve their evil alien purposes" then I know nothing about
it but it definitely doesn't have anything to do with what I do.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Take a look at this URL and tell me which one PHP does look like:
http://kaistizen.net/Project/CSharpJava/csharp_java.htm#NamespaceVsPackageNeither, actually. But it's not about "should we imitate C# or Java".
It's about what's best for PHP. My opinion is that for PHP would be best
to have namespaces and not packages.From Portuguese Brazilian Wikipedia: http://pt.wikipedia.org/wiki/Package
Translated to you....In English, it says:
A software package is a bundle of one or several files that either are
necessary for the execution of a computer program, or add features for a
program already installed on the computer or network of computers.
A software package is that beautiful box you go to the supermarket and
buy the product. A package in programming language is exactly what I
wrote to you.
All you told until now in favor of namespaces are marketing related.
Just read your previous messages.OK, let's see - what is "marketing"? If it's "a set of efforts aimed at
promoting better understanding and wider usage of PHP language" than I
don't see how it can be bad and how it is not important to consider.If it's "an evil conspiracy of suit-wearing aliens to subvert PHP
community to serve their evil alien purposes" then I know nothing about
it but it definitely doesn't have anything to do with what I do.
No. You mentioned not only once that namespace are better for users to
understand than packages.
Seems you are the only one until now that still want to keep "namespace".
But I already have a solution to it.... I already mentioned on IRC.
Instead of namespace or package, you can go to something like
zendspace or stanspace
That's my final 2 cents. I hope I do not have to come back and write
another message here. It's up to you to decide which you think is best
for PHP. I am not a good C programmer and I can't really purpose a
patch to something better. I only have my ideas that I can try to talk
to you. ALA I put myself on a month to study the PHP's source, I can't
help in development.
Best regards,
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco@hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil
Take a look at this URL and tell me which one PHP does look like:
http://kaistizen.net/Project/CSharpJava/csharp_java.htm#NamespaceVsPackageNeither, actually. But it's not about "should we imitate C# or Java".
It's about what's best for PHP. My opinion is that for PHP would be best
to have namespaces and not packages.From Portuguese Brazilian Wikipedia: http://pt.wikipedia.org/wiki/Package
Translated to you....In English, it says:
A software package is a bundle of one or several files that either are
necessary for the execution of a computer program, or add features for a
program already installed on the computer or network of computers.A software package is that beautiful box you go to the supermarket and
buy the product. A package in programming language is exactly what I
wrote to you.All you told until now in favor of namespaces are marketing related.
Just read your previous messages.OK, let's see - what is "marketing"? If it's "a set of efforts aimed at
promoting better understanding and wider usage of PHP language" than I
don't see how it can be bad and how it is not important to consider.If it's "an evil conspiracy of suit-wearing aliens to subvert PHP
community to serve their evil alien purposes" then I know nothing about
it but it definitely doesn't have anything to do with what I do.No. You mentioned not only once that namespace are better for users to
understand than packages.Seems you are the only one until now that still want to keep "namespace".
But I already have a solution to it.... I already mentioned on IRC.Instead of namespace or package, you can go to something like
zendspace or stanspace
+1 zendspace
Tijnema
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
A software package is that beautiful box you go to the supermarket and
buy the product. A package in programming language is exactly what I
wrote to you.
If by programming language you mean Java, since some people consider
these to be synonymous ;)
No. You mentioned not only once that namespace are better for users to
understand than packages.
Yep.
Seems you are the only one until now that still want to keep "namespace".
That's not true. Even if you discount people that don't care or dare
enough to write on the list, there were still people who wrote in
support of keeping "namespace" and they weren't me :)
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev wrote:
Wikipedia also define the term MVC. But alas, that is a conceptual
definition, not blueprints for implementation.Who cares about the implementation? It's still MVC. So let's implement
MVC and call it "distributed enterprise messaging" and then let's spend
next 2 years explaining that it was really MVC that we meant.
My point is simply that there is a different between the concept and
someones interpretation of the concept that influences an actual
implementation. MVC, although overly used in these web 2.1-rc4 days, is
not a product, or even an implementation.. Its a pattern for development
and a concept. ZF-MVC is an implementation of this pattern, as is
Symfony, as is RoR, as is Django.
I use the concept of Namespaces to build a more OO friendly session
object for Zend_Session. Which is why we have a class called
Zend_Session_Namespace. Point being, its an implementation of the
namespace concept within an implementation of a component in the Zend
Framework.
namespaces and packages. But the general taste this will leave in
peoples mouthes is package, even if it is a Grapple.I am still waiting to know what is package? I know what is namespace -
and I for everybody that doesn't know I can explain it in 2 minutes with
one hand tied behind my back. But what is "package"?
PACKAGES ARE a namespace implementation with file/directory/and or other
filesystem restrictions.
I would go out on a limb and say that if you surveyed a large majority
of languages and developers, that statement above would fit most peoples
perception of "what a package is".
current implementation doesn't have braces; this (consequently) adds a
Ouch, not braces again. What is it with braces that you need them so
badly? Many languages aren't using the things ever, isn't it a proof
that there's life outside braces? ;)
Its not a point of needing them so badly. The point is what the lack of
braces implies within the language itself. Instead of namespace scope
ending at a brace, its now ending at the end OF A FILE; hence
introducing a FILESYSTEM restriction.
Questions: can I run an interactive php shell and define a few
namespaces and classes to use in a runtime environment? Say, using,
PHP_Shell in pear?
Can I have more than one namespace in a single file?
library "packages". Point in case is how the ZF has used a
pesudo-namespace-ing class name to accomplish the very same thing.ZF is using Very_Very_Long_And_Very_Irritating_Class_Names because
there's no choice to do otherwise. That's why we wrote namespaces - to
provide this choice.
True, but we are also talking about library components that are
regulated by some coding standards, specifically, the one class per file
requirement. This itself is not a PHP thing, its a ZF-Coding Standards
thing. Using package implies a "one namespaced package per file rule"
whereas the simple term of "namespace" does not (at least to me).
+1 on package, it makes the most sense regardless of the marketing
draw of "namespace" support.Please re-read my mail on perception. "Marketing" here is just a way to
say "perception" so it sounds bad to some people for some reason.
Well, you talked about sending out the press release about "PHP has
namespace support!".. and that is pure marketing ;)
But I agree with you in that the long term goal is about developer
perception, and thats why its important to have this decided.
-ralph
current implementation doesn't have braces; this (consequently) adds a
Ouch, not braces again. What is it with braces that you need them so
badly? Many languages aren't using the things ever, isn't it a proof
that there's life outside braces? ;)
Well.. My guess is that If current implementation had braces all this
namespace/package
thing wouldn't be even discussed now. Everyone would agree that it's
namespace thing
even if one must put all file contents inside braces for parser to be happy.
However without braces current implementation looks like nothing else
in PHP. This gives
people a space to improvise and/or pushes to look for similarities of
syntax in other
languages and it seems that the closest match is Java with its
packages even though the functionality is different.
I don't want to start braces discussion again but may suggest consider
adding them?
Pros:
- It would end this discussion
- It would be good for FC. If there would be decided to allow more
then one namespace
per file in the future. - Syntax would be more consistent with existing constructs in the language
(classes/functions/etc)
To sum up I think we have namespaces functionality with syntax similar
to Java packages.
Now the question is do we want developers to:
- use namespaces anr/or mimic packages functionality with "namespace" if they
want to (+1 for namespace)
OR - use "package" the way it shouldn't be to mimic simple namespaces if they don't
like/want/need packages (+1 for package)
Regards,
Giedrius
If PHP team release in the news:
PHP has namespace support!
OR
PHP has package support!Everyone will understand what does that mean. Those that do not
I wouldn't. And that's not because I'm so dense, but because "package"
could mean anything, from next generation autoloader (I myself proposed
such concept a while ago, and others did too) to integrating PHAR
support into core.
That's a fair point, I think. "Package" seems to imply "distributable".
While one can use a namespace as a way to segregate a distributable package,
that's not the only use of it and not the one I see myself using it for.
--
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
Stanislav Malyshev schrieb:
Could you give definition of what is a package, so we could see if it
resembles more of a package or less?
http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html
--
Sebastian Bergmann http://sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69
Could you give definition of what is a package, so we could see if it
resembles more of a package or less?http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html
I wonder why everybody here talks about one and only one language -
Java... It's not like programming languages begin and end with Java, is it?
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev schrieb:
I wonder why everybody here talks about one and only one language -
Java.
Java just happens to be the programming language that I associate the
most with the programming language feature in question.
--
Sebastian Bergmann http://sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69
Java just happens to be the programming language that I associate the
most with the programming language feature in question.
So for you packages == Java packages. Great, since PHP does not have
Java packages, problem solved, it's not packages.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev schrieb:
So for you packages == Java packages. Great, since PHP does not have
Java packages, problem solved, it's not packages.
You asked for a specification of packages in a programming language.
I just pointed you to the specification of packages in Java.
That's all :)
--
Sebastian Bergmann http://sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69
You asked for a specification of packages in a programming language.
I just pointed you to the specification of packages in Java.
Yes, I know Java implements packages this way. And Perl implements them
other way. And C yet another way.
And PHP has at least three packaging implementations which have nothing
to do with namespacing and a bunch of proposals in addition to it.
That's the whole point - "package" doesn't describe any specific
concept, unless you talk about specific language or specific
functionality - like rpm or jar, which are packages too.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Java just happens to be the programming language that I associate the
most with the programming language feature in question.So for you packages == Java packages. Great, since PHP does not have
Java packages, problem solved, it's not packages.
So for you namespaces == C namespaces. Great, since PHP does not have
C packages, problem solved, it's not namespaces.
;-)
Tijnema
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
So for you namespaces == C namespaces. Great, since PHP does not have
C packages, problem solved, it's not namespaces.
I gave you description of namespaces which clearly states what namespace
is, and has nothing to do with C or any specific programming language at
all. When I asked what is the package, I got description of particular
syntax in Java. Feel the difference?
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
So for you namespaces == C namespaces. Great, since PHP does not have
C namespaces, problem solved, it's not namespaces.I gave you description of namespaces which clearly states what namespace
is, and has nothing to do with C or any specific programming language at
all. When I asked what is the package, I got description of particular
syntax in Java. Feel the difference?
Yes, I feel the difference ;-) But, the description os namespaces you
gave is not exactly what is implemented in PHP, it might come close.
So PHP does also not have namespaces... neither has it packages, so I
would say that it's something unique, and needs an unique name..
Tijnema
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info
Hi,
All of the debate over whether this is a true namespace implementation
is in my opinion completely bogus (translate: I think "namespace" is a
fine choice for the reserved word, and "package" is a dangerously
misleading choice), but since there is so much noisy dissent, I have an
alternative proposal I'd like to float:
How about using the keyword "prefix" or "nameprefix" instead of
"namespace"? This will be clearer and can be easily defined with 2
sentences similar to the original proposal: "All class and function
names inside the file are automatically prefixed with the
(prefix|nameprefix) name. In other files, classes and functions can be
imported with different names (aliases) to eliminate naming conflicts or
reduce typing needed."
I quote from the original "Simple Namespace Proposal" message by Dmitry:
From the beginning:
Main assumption of the model is that the problem that we are to solve is the
problem of the very long class names in PHP libraries. We would not attempt
to take autoloader's job or create packaging model - only make names
manageable.
From the middle:
Namespace definition does the following:
All class and function names inside are automatically prefixed with
namespace name.
As stated, because this proposal only defines a prefix for functions
and class names, it is not a packaging model. All package models in
existence define some kind of self-contained entity that groups related
files and their contents together in a way that allows them to be
"packaged" into a single thing, like a jar, a PEAR .tgz, or a .phar
file. This proposal does none of these things. Simply because the
prefix is defined per-file does not a package make. By the same logic,
using ".php" at the end of a file or ".dat" at the end of a file creates
special packages of php or dat information, because the extension
applies to the whole file at once. Simply defining the contents of a
file does not imply any organization whatsoever.
What the original proposal does do is provide a namespace prefix - it
defines a scope within which all names have a special prefix. This is
not rocket science.
<rant>On a personal note, if you feel you must reply to this thread
further, please follow this checklist:
- is anything I am saying bring a new idea to the debate?
- is there a patch that converts my new idea into a reality attached to
the message?
If you can't answer "yes" to either of these, please go immediately to
jail, do not pass go, do not collect $200.</rant>
Thank you to Dmitry for this much-needed idea.
Thanks,
Greg
I've been reading this lengthy discussion and here's a sumup of what I
found:
- PHP's implementation is only a part of what most people expect to find
when they hear "php has namespace support" - PHP's implementation looks a bit like JAVA's package support, and a
bit like many other (differently names) features in other languages. It
however does not match 1:1 to any of those.
So, everyone here has agreed already that "namespaces" !=== PHP's
implementation (it might ==, but not ===). Same goes for Package.
I find the idea of Greg to be very good though, reading the original
proposal, it often names things not "namespace" but simply "prefix".
What do you do with your names? you use a prefix, you don't expect it to
have "full namespace support just like [insert any other language
here]", nor do you expect it to "be exactly like a JAVA package".
When announced, you could simply state "PHP now has support for
prefixing, PHP's own specific implementation of namespaces". Because
that's what you have, you can complain that "according to the definition
of [word] it is that.", but you can't really. The "definition" of a
word like namespace, package, etc. is not independent of its
implementation in majorly used languages unfortunately. If you ask a
random coder "what is a namespace", the answer will always be based on
an implementation in a language the person uses/likes a lot. You can
quote from wikipedia, but that doesn't really mean anything (sorry
Stas), what we should try to do here is find the proper name which
identifies the implementation we have for what it is.
prefix Foo;
alias Foo:Bar as Quux;
Looks very good to me as it clearly shows what happens, internally and
externally. It's not a namespace as such, it's not a package as such,
it's simply what PHP does.
I hope this will help the discussion steer away from the standard
arguments that have been used constantly, and that will simply not change.
- Tul
Gregory Beaver wrote:
Hi,
All of the debate over whether this is a true namespace implementation
is in my opinion completely bogus (translate: I think "namespace" is a
fine choice for the reserved word, and "package" is a dangerously
misleading choice), but since there is so much noisy dissent, I have an
alternative proposal I'd like to float:How about using the keyword "prefix" or "nameprefix" instead of
"namespace"? This will be clearer and can be easily defined with 2
sentences similar to the original proposal: "All class and function
names inside the file are automatically prefixed with the
(prefix|nameprefix) name. In other files, classes and functions can be
imported with different names (aliases) to eliminate naming conflicts or
reduce typing needed."I quote from the original "Simple Namespace Proposal" message by Dmitry:
From the beginning:
Main assumption of the model is that the problem that we are to solve is the
problem of the very long class names in PHP libraries. We would not attempt
to take autoloader's job or create packaging model - only make names
manageable.From the middle:
Namespace definition does the following:
All class and function names inside are automatically prefixed with
namespace name.As stated, because this proposal only defines a prefix for functions
and class names, it is not a packaging model. All package models in
existence define some kind of self-contained entity that groups related
files and their contents together in a way that allows them to be
"packaged" into a single thing, like a jar, a PEAR .tgz, or a .phar
file. This proposal does none of these things. Simply because the
prefix is defined per-file does not a package make. By the same logic,
using ".php" at the end of a file or ".dat" at the end of a file creates
special packages of php or dat information, because the extension
applies to the whole file at once. Simply defining the contents of a
file does not imply any organization whatsoever.What the original proposal does do is provide a namespace prefix - it
defines a scope within which all names have a special prefix. This is
not rocket science.<rant>On a personal note, if you feel you must reply to this thread
further, please follow this checklist:
- is anything I am saying bring a new idea to the debate?
- is there a patch that converts my new idea into a reality attached to
the message?If you can't answer "yes" to either of these, please go immediately to
jail, do not pass go, do not collect $200.</rant>Thank you to Dmitry for this much-needed idea.
Thanks,
Greg
Hi,
Has anyone thought of the keyword "phpspace"?
2007/8/17, M. Sokolewicz tularis@php.net:
I've been reading this lengthy discussion and here's a sumup of what I
found:
- PHP's implementation is only a part of what most people expect to find
when they hear "php has namespace support"- PHP's implementation looks a bit like JAVA's package support, and a
bit like many other (differently names) features in other languages. It
however does not match 1:1 to any of those.So, everyone here has agreed already that "namespaces" !=== PHP's
implementation (it might ==, but not ===). Same goes for Package.
I find the idea of Greg to be very good though, reading the original
proposal, it often names things not "namespace" but simply "prefix".
What do you do with your names? you use a prefix, you don't expect it to
have "full namespace support just like [insert any other language
here]", nor do you expect it to "be exactly like a JAVA package".When announced, you could simply state "PHP now has support for
prefixing, PHP's own specific implementation of namespaces". Because
that's what you have, you can complain that "according to the definition
of [word] it is that.", but you can't really. The "definition" of a
word like namespace, package, etc. is not independent of its
implementation in majorly used languages unfortunately. If you ask a
random coder "what is a namespace", the answer will always be based on
an implementation in a language the person uses/likes a lot. You can
quote from wikipedia, but that doesn't really mean anything (sorry
Stas), what we should try to do here is find the proper name which
identifies the implementation we have for what it is.prefix Foo;
alias Foo:Bar as Quux;Looks very good to me as it clearly shows what happens, internally and
externally. It's not a namespace as such, it's not a package as such,
it's simply what PHP does.I hope this will help the discussion steer away from the standard
arguments that have been used constantly, and that will simply not change.
- Tul
Gregory Beaver wrote:
Hi,
All of the debate over whether this is a true namespace implementation
is in my opinion completely bogus (translate: I think "namespace" is a
fine choice for the reserved word, and "package" is a dangerously
misleading choice), but since there is so much noisy dissent, I have an
alternative proposal I'd like to float:How about using the keyword "prefix" or "nameprefix" instead of
"namespace"? This will be clearer and can be easily defined with 2
sentences similar to the original proposal: "All class and function
names inside the file are automatically prefixed with the
(prefix|nameprefix) name. In other files, classes and functions can be
imported with different names (aliases) to eliminate naming conflicts or
reduce typing needed."I quote from the original "Simple Namespace Proposal" message by Dmitry:
From the beginning:
Main assumption of the model is that the problem that we are to solve
is the
problem of the very long class names in PHP libraries. We would not
attempt
to take autoloader's job or create packaging model - only make names
manageable.From the middle:
Namespace definition does the following:
All class and function names inside are automatically prefixed with
namespace name.As stated, because this proposal only defines a prefix for functions
and class names, it is not a packaging model. All package models in
existence define some kind of self-contained entity that groups related
files and their contents together in a way that allows them to be
"packaged" into a single thing, like a jar, a PEAR .tgz, or a .phar
file. This proposal does none of these things. Simply because the
prefix is defined per-file does not a package make. By the same logic,
using ".php" at the end of a file or ".dat" at the end of a file creates
special packages of php or dat information, because the extension
applies to the whole file at once. Simply defining the contents of a
file does not imply any organization whatsoever.What the original proposal does do is provide a namespace prefix - it
defines a scope within which all names have a special prefix. This is
not rocket science.<rant>On a personal note, if you feel you must reply to this thread
further, please follow this checklist:
- is anything I am saying bring a new idea to the debate?
- is there a patch that converts my new idea into a reality attached to
the message?If you can't answer "yes" to either of these, please go immediately to
jail, do not pass go, do not collect $200.</rant>Thank you to Dmitry for this much-needed idea.
Thanks,
Greg--
--
Best regards,
Jingcheng Zhang
Room 304, Dormitory 26 of Yuquan Campus, Zhejiang University
P.R.China
prefix Foo;
alias Foo:Bar as Quux;
If namespaces have to be renamed, then IMHO this proposal is the best so far.
"alias" would also remove confusion from statement like import Foo
because alias Foo
is clearly no-op per se. At least to me ;-)
Regards,
Giedrius
http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html
Thinking on 'packages' further I think that part of my objection to
use of the term for PHP is that Java provides built-in packages
(java.io etc etc) while PHP doesn't/will not for this release.
Announcing that PHP has package support yet not bundling any actual
packages seems a misnomer.
--
Marc Gear
marcgear@gmail.com
Here we come again.... =\
So for you namespaces == C namespaces. Great, since PHP does not have
C packages, problem solved, it's not namespaces.I gave you description of namespaces which clearly states what namespace
is, and has nothing to do with C or any specific programming language at
all. When I asked what is the package, I got description of particular
syntax in Java. Feel the difference?
Read the purpose of both, which restrictions/limitations both have,
how are they defined, how are they used, etc and you'll see if the
current implementation is more like 'namespace' or 'package'. It's not
related to package Java, namespace C, def, zendspace of whatever.
The following itens ARE THE MAJOR DIFFERENCES between namespaces and packages.
I already highlighted you which structural changes will change my vote
from one to another, and I'll publish it again... maybe you forget to
read it.
- Remove the restriction to one package/namespace per file
- Use curly braces to define one namespace
- Allow nested definitions namespace N1 { namespace SubN1 { ... }
namespace Sub2N1 { ... } } - using/import is related to the namespace/package/whatever scope.
This is one of the explanations to use curly braces in namespaces (and
not in packages). You tell me 'namespace' are unique. I agree, but
3rdparty libraries using the name namespace alias will still mess the
entire application. So let's follow bjori (IRC) idea and create the
"filescope"!
If you need more information about WHY I added this item, read my
previous email.
Once you incorporate these changes (and not only curly braces as you
said on a previous email), I'll change my vote from package to
namespace.
So for you namespaces == C namespaces. Great, since PHP does not have
C namespaces, problem solved, it's not namespaces.I gave you description of namespaces which clearly states what namespace
is, and has nothing to do with C or any specific programming language at
all. When I asked what is the package, I got description of particular
syntax in Java. Feel the difference?Yes, I feel the difference ;-) But, the description os namespaces you
gave is not exactly what is implemented in PHP, it might come close.
So PHP does also not have namespaces... neither has it packages, so I
would say that it's something unique, and needs an unique name..
dreaming zendspace.... =)
http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html
Thinking on 'packages' further I think that part of my objection to
use of the term for PHP is that Java provides built-in packages
(java.io etc etc) while PHP doesn't/will not for this release.Announcing that PHP has package support yet not bundling any actual
packages seems a misnomer.
I do not agree. PHP always lived with a bunch of libraries (MySQL,
XML, etc) and the fact that it uses or not uses the newly added
feature is not a misnomer. Otherwise we'll move from PHP as a
structural/oo language to a frameworked language like C# or Java, that
you have to do:
$db = new PHP::Sql::PDO::Connection(); // creates PDOConnection object
...
The fact of added/rename a feature has nothing related to that
language support built-in packages/namespaces or not.
If you think you're still right with your assertion, once PHP
incorporates namespace then (following the opposite of your idea), and
not bundling built-in namespaces are misnomer too (C# supports
namespaces and has thousdands). See that what you said is irrelevant?
=)
http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html
Thinking on 'packages' further I think that part of my objection to
use of the term for PHP is that Java provides built-in packages
(java.io etc etc) while PHP doesn't/will not for this release.Announcing that PHP has package support yet not bundling any actual
packages seems a misnomer.--
Marc Gear
marcgear@gmail.com--
Regards,
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco@hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil
Read the purpose of both, which restrictions/limitations both have,
how are they defined, how are they used, etc and you'll see if the
current implementation is more like 'namespace' or 'package'. It's not
related to package Java, namespace C, def, zendspace of whatever.
That's what I am trying to explain for a week now and still failing.
Namespace as a concept is not the same as implementation of namespaces
in C++ or Java. Packages as a concept is not the same as implementation
of packages in Java, Perl, C or PHP. PHP is neither C++ not Java.
Choosing which language to mimic - Java or C++ - is not the right way to
think about the problem. PHP is separate language, not C++ or Java. Just
because C++ has + and PHP has + doesn't mean PHP should have operator
overloading. Just because PHP has multi-component names and Java has
multi-component names doesn't mean namespace definition operator should
be the same keyword. That's what I'm trying to explain - the choice is
not "should we be like C++ or like Java". We may end up being like it -
or not, but it is not the choice we have.
- Allow nested definitions namespace N1 { namespace SubN1 { ... }
namespace Sub2N1 { ... } }
That most probably won't happen ever. If you want to know why, look up
the nested class saga. In short - too much trouble to implement
consistently, too bad runtime performance (unlimited lookup depth at
runtime).
not in packages). You tell me 'namespace' are unique. I agree, but
3rdparty libraries using the name namespace alias will still mess the
entire application. So let's follow bjori (IRC) idea and create the
"filescope"!
I'm afraid I don't understand - what would filescope do?
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Read the purpose of both, which restrictions/limitations both have,
how are they defined, how are they used, etc and you'll see if the
current implementation is more like 'namespace' or 'package'. It's not
related to package Java, namespace C, def, zendspace of whatever.That's what I am trying to explain for a week now and still failing.
Namespace as a concept is not the same as implementation of namespaces
in C++ or Java. Packages as a concept is not the same as implementation
of packages in Java, Perl, C or PHP. PHP is neither C++ not Java.
Choosing which language to mimic - Java or C++ - is not the right way to
think about the problem. PHP is separate language, not C++ or Java. Just
because C++ has + and PHP has + doesn't mean PHP should have operator
overloading. Just because PHP has multi-component names and Java has
multi-component names doesn't mean namespace definition operator should
be the same keyword. That's what I'm trying to explain - the choice is
not "should we be like C++ or like Java". We may end up being like it -
or not, but it is not the choice we have.
That's why I purposed the unique name. Also it follows the Gregory not
so likely email.
You can use zendspace. (Gregory) If you want me to get Johannes patch
and convert it to zendspace, just tell me.
- Allow nested definitions namespace N1 { namespace SubN1 { ... }
namespace Sub2N1 { ... } }That most probably won't happen ever. If you want to know why, look up
the nested class saga. In short - too much trouble to implement
consistently, too bad runtime performance (unlimited lookup depth at
runtime).
That's what I imagine it happens, otherwise that was no reason to not
allow more than one namespace/package per file.
not in packages). You tell me 'namespace' are unique. I agree, but
3rdparty libraries using the name namespace alias will still mess the
entire application. So let's follow bjori (IRC) idea and create the
"filescope"!I'm afraid I don't understand - what would filescope do?
The reason to something like that is when you do:
import Foo::Bar as MyBar;
$c = new MyBar::NestedClass();
This can still cause a conflict.
Let me try to illustrate with a real world example (but hypotetical).
I use Zend Framework and at the same time ADOdb. Both has its
namespaces/packages:
namespace/package/zendspace/whatever Zend::DB;
class Connection { ... }
namespace ADO::DB;
class Connection { ... }
Internally in the Zend framework (in a class definition, for exmaple),
it can use:
package Zend::Foo;
import Zend::DB as DB;
$c = new DB::Connection();
And internally in the ADO package:
namespace ADO::Bar;
import ADO::DB as DB;
$c = new DB::Connection();
What will happen in this situation?
The idea of file scope works like this:
If it's internal to a package/namespace, that alias is restricted to
THAT package/namespace. If it's not internal to any space, it's global
and can be used as expected.
I think my idea is better explained with an example:
File: ORM/Client.php
<?php
namespace ORM
// Assign namespace in localscope (file scope, based on PHP implementation)
import System; // Contains Console class which controle I/O, like C#
class Client {
function __construct() {
Console::println( "Client created!" );
}
}
?>
File: index.php
<?php
// Console directly is unreachable, you must do this:
System::Console::println( "Unreachable" );
// Or import System again to allow it in global scope
import System;
Console::println( "Reachable now!" );
?>
Do you understand the idea now? I can try to explain differently if needed.
Regards,
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
--
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: guilhermeblanco@hotmail.com
URL: http://blog.bisna.com
São Carlos - SP/Brazil
You can use zendspace. (Gregory) If you want me to get Johannes patch
and convert it to zendspace, just tell me.
So it goes like this:
PHP Group: "Good news everyone! PHP now has zendspaces!".
PHP users: "WTF???"
Internally in the Zend framework (in a class definition, for exmaple),
it can use:package Zend::Foo;
import Zend::DB as DB;
$c = new DB::Connection();And internally in the ADO package:
namespace ADO::Bar;
import ADO::DB as DB;
$c = new DB::Connection();What will happen in this situation?
Exactly what you thought would happen - first one would resolve as
Zend::DB::Connection and second one as ADO::DB::Connection. Only note is
that you should write not "import Zend::DB as DB" but just "import
Zend::DB" - it's prettier this way ;)
If it's internal to a package/namespace, that alias is restricted to
THAT package/namespace. If it's not internal to any space, it's global
and can be used as expected.
Import'ed alias is always restricted to the file it appeared in.
// Assign namespace in localscope (file scope, based on PHP implementation)
import System; // Contains Console class which controle I/O, like C#
"import Something" isn't allowed. Sorry, I know it's not like C++ works,
but I don't see any way to make it do anything meaningful without having
the same global space pollution problem. Maybe we should rename "import"
to "using" or something?
Do you understand the idea now? I can try to explain differently if needed.
From what I understand, it's exactly like it works now with only
difference being that "import Foo" is not allowed since it's not doing
anything.
--
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
You can use zendspace. (Gregory) If you want me to get Johannes patch
and convert it to zendspace, just tell me.So it goes like this:
PHP Group: "Good news everyone! PHP now has zendspaces!".
PHP users: "WTF???"
PHP Group: "It's like a namespace -- but, you know, the PHP way."
PHP users: "Awesome!"
Alternately:
PHP Group: "Good news everyone! PHP now has namespaces!".
PHP users: "Awesome!"
PHP users: "Wait.. WTF? These don't act like namespaces - where are
the braces?"
PHP users: "These act more like... Java packages. Why are they called
namespaces?"
I would suggest that the world at large will react in the same
fashion as this list. Using a name already in use by the most popular
programming language in the world is going to create the expectation
that the feature works in the same way. Using a different name will
not create that false expectation, nor the subsequent confusion.
My $0.02
scott.
PHP users: "Wait.. WTF? These don't act like namespaces - where are the
braces?"
That's like saying "BMW Z4 is not a car - it has only two seats!"
PHP users: "These act more like... Java packages. Why are they called
namespaces?"
Java packages are namespace implementation, btw.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
PHP users: "Wait.. WTF? These don't act like namespaces - where
are the braces?"That's like saying "BMW Z4 is not a car - it has only two seats!"
That doesn't change the fact that that was the very reaction of this
list.
PHP users: "These act more like... Java packages. Why are they
called namespaces?"Java packages are namespace implementation, btw.
Indeed, I am not arguing that.
Recognizing that their implementation was different than the C++
feature, the Java folks chose a different name. Because they knew
that if they put out a feature with the same name as a C++ feature,
people would assume it works the same way as the C++ feature. I would
prefer that PHP's namespace feature not be overshadowed by confusion
caused by it's keyword.
scott.
PHP users: "Wait.. WTF? These don't act like namespaces - where
are the braces?"That's like saying "BMW Z4 is not a car - it has only two seats!"
That doesn't change the fact that that was the very reaction of this
list.
STOP THE PRESSES!!! I've got it... we can call them... dun dun dun
namespayces
PHP Group: Good news all! PHP now has namespayces!!!
PHP users: WTF??!
PHP Group: it's like a namespace but without some of the functionality.
PHP users: WTF!
PHP Group: shudup, it sounds better than neuterspaces or zendspaces!
PHP users: LYNCH! LYNCH!!
Richard Lynch: Don't look at me!!
Cheers,
Rob.
...........................................................
SwarmBuy.com - http://www.swarmbuy.com
Leveraging the buying power of the masses!
...........................................................
Hello Stanislav,
Thursday, August 16, 2007, 7:13:45 PM, you wrote:
Read the purpose of both, which restrictions/limitations both have,
how are they defined, how are they used, etc and you'll see if the
current implementation is more like 'namespace' or 'package'. It's not
related to package Java, namespace C, def, zendspace of whatever.
That's what I am trying to explain for a week now and still failing.
Wrong!!!! You started to defend the current state with a non existing JS
feature. And then you found a wiki page. Wow now wiki is the
all-knowing-trash-dump?
Namespace as a concept is not the same as implementation of namespaces
in C++ or Java. Packages as a concept is not the same as implementation
of packages in Java, Perl, C or PHP. PHP is neither C++ not Java.
Choosing which language to mimic - Java or C++ - is not the right way to
think about the problem. PHP is separate language, not C++ or Java. Just
because C++ has + and PHP has + doesn't mean PHP should have operator
overloading. Just because PHP has multi-component names and Java has
multi-component names doesn't mean namespace definition operator should
be the same keyword. That's what I'm trying to explain - the choice is
not "should we be like C++ or like Java". We may end up being like it -
or not, but it is not the choice we have.
So going with existing expectation is good or bad?
And then if there are two things, The concept and the implementation.
Wouldn't it make sense to not use the marking relevant one in the
implementation and instead use package in the implementation as that is what
we are implementing. At least when looking at the code and its behavior. And
then use the damn word 'namespaces' in PR material? Oh and don't forget your
namespace wiki matches both concepts. The concept of namespace in existing
languages (with nesting and stuff) and the package stuff which is limited to
one per file.
Best regards,
Marcus
So going with existing expectation is good or bad?
Having our implementation match some existing one because the solution
is right for both - good. Imitating existing implementation just because
it exists in some other language - bad (not always, but in this case).
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Subject: File Struture
Comments:
Namespace do not restrict directories (AFAIK)
Packages restrict directories (each package have a directory with its
name, like Zend/Cache/File.php)Question: What is the behavior of PHP in this situation?
PHP restricts the directory, just like packages. So,
Zend/Cache/File.php is the package Zend::Cache and has the class named
File
Did I miss something? The [namespace|package] implementation that went in is
file-based, but not directory based AFAIK. There's nothing preventing you
from having multiple files in a single directory that are in totally
different namespaces.
--
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
OO. And anyway, are we struggling to find excuses here? Can we in no way
ever at least try to be consistent in anything we do? That JS argument is an
How "consistent" had acquired a meaning of "doing it my way"? There's
nothing inconsistent in the name "namespace" and it is very consistent
with what people understand - I quoted wiki on that. I'm still waiting
for that non-"C++ does it with braces" argument btw.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
OO. And anyway, are we struggling to find excuses here? Can we in no way
ever at least try to be consistent in anything we do? That JS argument is anHow "consistent" had acquired a meaning of "doing it my way"? There's
nothing inconsistent in the name "namespace" and it is very consistent
with what people understand - I quoted wiki on that. I'm still waiting
for that non-"C++ does it with braces" argument btw.Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com--
I am for package because:
-
The keywords are actually the words used in similar technology as
such as java and python -
The single namespace per file is common to a package design but hey
-
No hierarchical namespaces (within one namespace)
-
I believe it will be easier to anyone who will be learning our
namespace/package to keep on going learning other languages. Since the
our implementation is very package like, it will not be so much
confusing for someone in C++ that will be using namespaces and will be
simple for someone coming from Java to use our package system (yet
less complex than java, thanks for that) -
For Stas (There are no brackets) :)
-
Because no one can say "Do you have a patch?" since there is already
one made and ready to be applied.
I now stand as a spectator.
do I get a 2 cents or so ? :P
0x02 cents.
D
Stas,
Namespace implementations for languages have been around for decades
in one form or another. People use the languages they are used to
developing in to demonstrate their points on how it should work, and
what it should be called when it works a certain way. Its 2007. Given
that we have the benefit of seeing how other languages have attempted to
solve the problem over the years, we can then devise our own
implementation to satisfy the demand. We cannot ignore other languages
implementations that got us to where we are today in language/compiler
design.
At the end of the day, there are two camps of people for naming:
packages vs. namespaces.
You seem to be missing the point that having braces is not for vanity's
sake, and is truly important to the implementation thus lending itself
to actual naming of the implementation.
a) BY NOT HAVING BRACES you have subscribed to FILE BASED scope
termination, thus tying the SCOPING of namespaces to a FILE.
b) BY HAVING BRACES you would be subscribing to a model that terminates
scope of namespace constructs to current scope they are defined within.
The former lends itself to being called a "package" the later lends
itself to being called a "namespace".
You did not answer my other questions on multiple namespaces per file,
and interactive php namespace usage.
-ralph
Stanislav Malyshev wrote:
OO. And anyway, are we struggling to find excuses here? Can we in no way
ever at least try to be consistent in anything we do? That JS argument
is anHow "consistent" had acquired a meaning of "doing it my way"? There's
nothing inconsistent in the name "namespace" and it is very consistent
with what people understand - I quoted wiki on that. I'm still waiting
for that non-"C++ does it with braces" argument btw.
Hello Ralph,
thanks for the very good explanation, but don't expect to get anything
back.... it is the same arguemnt I tried already - Expectations based on
experience from existing languages. Rather then reachign for the straw of
non existing features in other languages.
best regards
marcus
Thursday, August 16, 2007, 8:24:10 PM, you wrote:
Stas,
Namespace implementations for languages have been around for decades
in one form or another. People use the languages they are used to
developing in to demonstrate their points on how it should work, and
what it should be called when it works a certain way. Its 2007. Given
that we have the benefit of seeing how other languages have attempted to
solve the problem over the years, we can then devise our own
implementation to satisfy the demand. We cannot ignore other languages
implementations that got us to where we are today in language/compiler
design.
At the end of the day, there are two camps of people for naming:
packages vs. namespaces.
You seem to be missing the point that having braces is not for vanity's
sake, and is truly important to the implementation thus lending itself
to actual naming of the implementation.
a) BY NOT HAVING BRACES you have subscribed to FILE BASED scope
termination, thus tying the SCOPING of namespaces to a FILE.
b) BY HAVING BRACES you would be subscribing to a model that terminates
scope of namespace constructs to current scope they are defined within.
The former lends itself to being called a "package" the later lends
itself to being called a "namespace".
You did not answer my other questions on multiple namespaces per file,
and interactive php namespace usage.
-ralph
Stanislav Malyshev wrote:
OO. And anyway, are we struggling to find excuses here? Can we in no way
ever at least try to be consistent in anything we do? That JS argument
is anHow "consistent" had acquired a meaning of "doing it my way"? There's
nothing inconsistent in the name "namespace" and it is very consistent
with what people understand - I quoted wiki on that. I'm still waiting
for that non-"C++ does it with braces" argument btw.
Best regards,
Marcus