[Fwd: Re: Renaming namespaces to packages]

php.internals

Stanislav Malyshev

19 years ago
-------- 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

Keryx Web

19 years ago
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

Tijnema !

19 years ago
On 8/13/07, Keryx Web <webmaster@keryx.se> 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?? 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

Larry Garfield

19 years ago
On Monday 13 August 2007, Tijnema wrote:
> On 8/13/07, Keryx Web <webmaster@keryx.se> 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

Tijnema !

19 years ago
On 8/13/07, Larry Garfield <larry@garfieldtech.com> wrote:
> On Monday 13 August 2007, Tijnema wrote: > > On 8/13/07, Keryx Web <webmaster@keryx.se> 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. :-)
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

Richard Quadling

19 years ago
On 13/08/07, Tijnema <tijnema@gmail.com> wrote:
> 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!"

Giedrius D

19 years ago
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

Keryx Web

19 years ago
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

Marcus Börger

19 years ago
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:
> On Monday 13 August 2007, Tijnema wrote: >> On 8/13/07, Keryx Web <webmaster@keryx.se> 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

Alan Knowles

19 years ago
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:

Marcus Börger

19 years ago
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

Guilherme Blanco

19 years ago
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, On 8/14/07, Marcus Boerger <helly@php.net> wrote: > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- 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

David Coallier

19 years ago
On 8/14/07, Guilherme Blanco <guilhermeblanco@gmail.com> wrote:
> 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, > > On 8/14/07, Marcus Boerger <helly@php.net> wrote: > > 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 > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > 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

Marc Gear

19 years ago
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

Olivier Hill

19 years ago
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 On 8/15/07, Marc Gear <marcgear@gmail.com> wrote:

Marc Gear

19 years ago
On 8/15/07, Olivier Hill <olivier.hill@gmail.com> wrote:
> 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

Stanislav Malyshev

19 years ago
> 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

Guilherme Blanco

19 years ago
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, On 8/15/07, Stanislav Malyshev <stas@zend.com> wrote: > > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- 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

Stanislav Malyshev

19 years ago
> 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

Ralph Schindler

19 years ago
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

Larry Garfield

19 years ago
On Wednesday 15 August 2007, Stanislav Malyshev wrote:
> > 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

Sebastian Bergmann

19 years ago
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

Stanislav Malyshev

19 years ago
>> 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

Sebastian Bergmann

19 years ago
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

Marc Gear

19 years ago
On 8/16/07, Sebastian Bergmann <sb@sebastian-bergmann.de> wrote:
> 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

Guilherme Blanco

19 years ago
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? =) On 8/16/07, Marc Gear <marcgear@gmail.com> wrote: > On 8/16/07, Sebastian Bergmann <sb@sebastian-bergmann.de> wrote: > > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > 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

Larry Garfield

19 years ago
On Tuesday 14 August 2007, Guilherme Blanco wrote:
> 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

Stanislav Malyshev

19 years ago
> 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

David Coallier

19 years ago
On 8/14/07, Stanislav Malyshev <stas@zend.com> 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 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >
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

Ralph Schindler

19 years ago
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:

Marcus Börger

19 years ago
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 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.
Best regards, Marcus