# Renaming namespaces to packages

- Thread: https://externals.io/message/31509
- Original archive: https://news-web.php.net/php.internals/31509
- Started by johannes@php.net on 2007-08-10T09:26:32+00:00
- Messages: 23
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #31509 — johannes@php.net — 2007-08-10T09:26:32+00:00

URL: https://externals.io/message/31509#31509

Hi,

I think we reached the consensus to rename namespaces to packages as our
implementation is more package-like. Therefore I wrote the corresponding
patch which tries to get rid of all "namespaces" and "ns" (well, not all
"ns" only the namespace-related ones of course) used in the code.
Additionally I changed all package-tests. Any objections?

Does anybody (with the move-on-CVS-server powers) care about the history
of the tests? Then please cp ZendEngine2/tests/ns_* to pkg_* there else
I'll do a simple cvs rm and cvs add.

The patch is at
http://schlueters.de/~johannes/php/zend_namespace_to_package.diff and
the tarball with the changed tests at
http://schlueters.de/~johannes/php/zend_package_tests.tar.bz2

johannes

---

## #31510 — Marcus Boerger — 2007-08-10T10:46:41+00:00

URL: https://externals.io/message/31509#31510 · In reply to: #31509

Hello Johannes,

  thanks for the work, this even fixes the WS issues introduced by the
orgininal patch.

marcus

Friday, August 10, 2007, 11:26:32 AM, you wrote:

> Hi,

> I think we reached the consensus to rename namespaces to packages as our
> implementation is more package-like. Therefore I wrote the corresponding
> patch which tries to get rid of all "namespaces" and "ns" (well, not all
> "ns" only the namespace-related ones of course) used in the code.
> Additionally I changed all package-tests. Any objections?

All fine.

> Does anybody (with the move-on-CVS-server powers) care about the history
> of the tests? Then please cp ZendEngine2/tests/ns_* to pkg_* there else
> I'll do a simple cvs rm and cvs add.

I do not think that history is necessary for three week old files.

> The patch is at
> http://schlueters.de/~johannes/php/zend_namespace_to_package.diff and
> the tarball with the changed tests at
> http://schlueters.de/~johannes/php/zend_package_tests.tar.bz2

> johannes




Best regards,
 Marcus

---

## #31511 — Dmitry Stogov — 2007-08-10T12:00:06+00:00

URL: https://externals.io/message/31509#31511 · In reply to: #31509

Please don't commit it.
We didn't come to conclusion, what name is better 'namespace', 'package',
'packet' ...

Thanks. Dmitry.

> -----Original Message-----
> From: Johannes Schlьter [mailto:johannes@php.net] 
> Sent: Friday, August 10, 2007 1:27 PM
> To: PHP Internals List
> Cc: Dmitry Stogov
> Subject: [PHP-DEV] Renaming namespaces to packages
> 
> 
> Hi,
> 
> I think we reached the consensus to rename namespaces to 
> packages as our implementation is more package-like. 
> Therefore I wrote the corresponding patch which tries to get 
> rid of all "namespaces" and "ns" (well, not all "ns" only the 
> namespace-related ones of course) used in the code. 
> Additionally I changed all package-tests. Any objections?
> 
> Does anybody (with the move-on-CVS-server powers) care about 
> the history of the tests? Then please cp 
> ZendEngine2/tests/ns_* to pkg_* there else I'll do a simple 
> cvs rm and cvs add.
> 
> The patch is at 
> http://schlueters.de/~johannes/php/zend_namespace_to_package.d
iff and the tarball with the changed tests at
http://schlueters.de/~johannes/php/zend_package_tests.tar.bz2

johannes

---

## #31638 — Tijnema — 2007-08-16T18:27:57+00:00

URL: https://externals.io/message/31509#31638 · In reply to: #31509

> Hi,
>
> I think we reached the consensus to rename namespaces to packages as our
> implementation is more package-like. Therefore I wrote the corresponding
> patch which tries to get rid of all "namespaces" and "ns" (well, not all
> "ns" only the namespace-related ones of course) used in the code.
> Additionally I changed all package-tests. Any objections?
>
> Does anybody (with the move-on-CVS-server powers) care about the history
> of the tests? Then please cp ZendEngine2/tests/ns_* to pkg_* there else
> I'll do a simple cvs rm and cvs add.
>
> The patch is at
> http://schlueters.de/~johannes/php/zend_namespace_to_package.diff and
> the tarball with the changed tests at
> http://schlueters.de/~johannes/php/zend_package_tests.tar.bz2
>
> johannes
>

Just a little note, right now, your patch doesn't seem to work
Johannes. It's saying that `T_NAMESPACE` and T_NS can't be found in
Zend/zend_language_scanner.c.

Extra patch (that worked for me):

--------zend_packages_extra_patch.patch------
--- Zend/zend_language_scanner.c	31 Jul 2007 23:23:37 -0000
+++ Zend/zend_language_scanner.c	16 Aug 2007 20:13:24 -0000
@@ -5415,7 +5415,7 @@
 case 59:
 YY_RULE_SETUP
 {
-	return T_NAMESPACE;
+	return T_PACKAGE;
 }
 	YY_BREAK
 case 60:
@@ -5908,13 +5908,13 @@
 case 118:
 YY_RULE_SETUP
 {
-	if (CG(current_namespace)) {
-		*zendlval = *CG(current_namespace);
+	if (CG(current_package)) {
+		*zendlval = *CG(current_package);
 		zval_copy_ctor(zendlval);
 	} else {
 		ZVAL_EMPTY_TEXT(zendlval);
 	}
-	return T_NS_C;
+	return T_PKG_C;
 }
 	YY_BREAK
 case 119:
----------------------------------


Tijnema
-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

---

## #31639 — johannes@php.net — 2007-08-16T18:40:46+00:00

URL: https://externals.io/message/31509#31639 · In reply to: #31638

Hi Tijnema,


> 
> > […]
> 
> Just a little note, right now, your patch doesn't seem to work
> Johannes. It's saying that `T_NAMESPACE` and T_NS can't be found in
> Zend/zend_language_scanner.c.
> 
> Extra patch (that worked for me):
> 
> --------zend_packages_extra_patch.patch------
> --- Zend/zend_language_scanner.c	31 Jul 2007 23:23:37 -0000
> +++ Zend/zend_language_scanner.c	16 Aug 2007 20:13:24 -0000

If patching that file configure didn't find a proper flex version since
that file is generated from Zend/zend_language_scanner.l using flex.

johannes

> @@ -5415,7 +5415,7 @@
>  case 59:
>  YY_RULE_SETUP
>  {
> -	return T_NAMESPACE;
> +	return T_PACKAGE;
>  }
>  	YY_BREAK
>  case 60:
> @@ -5908,13 +5908,13 @@
>  case 118:
>  YY_RULE_SETUP
>  {
> -	if (CG(current_namespace)) {
> -		*zendlval = *CG(current_namespace);
> +	if (CG(current_package)) {
> +		*zendlval = *CG(current_package);
>  		zval_copy_ctor(zendlval);
>  	} else {
>  		ZVAL_EMPTY_TEXT(zendlval);
>  	}
> -	return T_NS_C;
> +	return T_PKG_C;
>  }
>  	YY_BREAK
>  case 119:
> ----------------------------------
> 
> 
> Tijnema
> -- 
> Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

---

## #31640 — Tijnema — 2007-08-16T18:50:39+00:00

URL: https://externals.io/message/31509#31640 · In reply to: #31639

> Hi Tijnema,
>
> 
> > […]
>
> If patching that file configure didn't find a proper flex version since
> that file is generated from Zend/zend_language_scanner.l using flex.
>
> johannes
>

Well, why does PHP compiles fine without the patch?, and why is this
file in the snapshot package when it is generated from flex?


I have flex 2.5.33 installed btw, that's fine right?

Tijnema
-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

---

## #31642 — johannes@php.net — 2007-08-16T19:27:39+00:00

URL: https://externals.io/message/31509#31642 · In reply to: #31640

Hi again,



> Well, why does PHP compiles fine without the patch?, and why is this
> file in the snapshot package when it is generated from flex?

Since snaps are for users, CVS versions (and patches) are for developers
and we expect developers to have the proper tools installed.

> I have flex 2.5.33 installed btw, that's fine right?

Yes, check the output of configure for details why it wasn't found.

> Tijnema

---

## #31644 — Derick Rethans — 2007-08-16T19:31:17+00:00

URL: https://externals.io/message/31509#31644 · In reply to: #31640

> Well, why does PHP compiles fine without the patch?, and why is this
> file in the snapshot package when it is generated from flex?
> 
> 
> I have flex 2.5.33 installed btw, that's fine right?

No it's not, we only support 2.5.4.

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

---

## #31643 — Tijnema — 2007-08-16T19:40:04+00:00

URL: https://externals.io/message/31509#31643 · In reply to: #31642

> Hi again,
>
> 
>
> > […]
>
> Since snaps are for users, CVS versions (and patches) are for developers
> and we expect developers to have the proper tools installed.

Ah, I'm sorry for that. I find it easier (and faster) to download a
snapshot instead of getting it from CVS.

>
> > […]
>
> Yes, check the output of configure for details why it wasn't found.


> No it's not, we only support 2.5.4.

Confusing answers, but anyway, configure doesn't fail on flex, neither
does it generate a warning or such. It says (from the log) Checking
for flex.. and Checking for flex version..

and btw derick, since when is 2.5.4 newer than 2.5.33? 2.5.4 has been
released in 1997, and 2.5.33 in 2006, which is still the latest stable
version atm.

-- 
Vote for PHP Color Coding in Gmail! -> http://gpcc.tijnema.info

---

## #31645 — johannes@php.net — 2007-08-16T19:47:42+00:00

URL: https://externals.io/message/31509#31645 · In reply to: #31642

> > […]
> 
> Yes, check the output of configure for details why it wasn't found.

Bah, I hate numbers. We need flex 2.5.4, not 2.5.33. 2.5.33 won't work
with the engine's skeleton file.

johannes

---

## #31646 — Derick Rethans — 2007-08-16T19:57:47+00:00

URL: https://externals.io/message/31509#31646 · In reply to: #31643

> 
> > […]

[snip]

> and btw derick, since when is 2.5.4 newer than 2.5.33? 2.5.4 has been
> released in 1997, and 2.5.33 in 2006, which is still the latest stable
> version atm.

I didn't say it was newer... the flex developers broken BC.

regards,
Derick

---

## #31647 — Antony Dovgal — 2007-08-16T20:00:17+00:00

URL: https://externals.io/message/31509#31647 · In reply to: #31643

> 
> > […]
> 
> Confusing answers, but anyway, configure doesn't fail on flex, neither
> does it generate a warning or such. It says (from the log) Checking
> for flex.. and Checking for flex version..

It has been discussed numerous times, search the archives.
Here is the link for starters:
https://sourceforge.net/tracker/?func=detail&atid=618177&aid=1447867&group_id=97492

For quick ones, the answer as to why nobody ever bothered about it:
http://marc.info/?l=php-dev&m=105066214431326&w=2
 
> and btw derick, since when is 2.5.4 newer than 2.5.33? 2.5.4 has been
> released in 1997, and 2.5.33 in 2006, which is still the latest stable
> version atm.

"Latest stable" doesn't always mean "better".
We still use autoconf 2.13 because it's been proved to be the most stable and fastest version ever.

But you're encouraged to change this, flex people have left some basic instructions, 
see the first link I mentioned above.

-- 
Wbr, 
Antony Dovgal

---

## #31680 — johannes@php.net — 2007-08-17T13:24:23+00:00

URL: https://externals.io/message/31509#31680 · In reply to: #31509

Hi,

I've updated the patch to be compatible with Dmitry's latest changes:
http://schlueters.de/~johannes/php/zend_namespace_to_package_20070817.diff

johannes


> Hi,
> 
> I think we reached the consensus to rename namespaces to packages as our
> implementation is more package-like. Therefore I wrote the corresponding
> patch which tries to get rid of all "namespaces" and "ns" (well, not all
> "ns" only the namespace-related ones of course) used in the code.
> Additionally I changed all package-tests. Any objections?
> 
> Does anybody (with the move-on-CVS-server powers) care about the history
> of the tests? Then please cp ZendEngine2/tests/ns_* to pkg_* there else
> I'll do a simple cvs rm and cvs add.
> 
> The patch is at
> http://schlueters.de/~johannes/php/zend_namespace_to_package.diff and
> the tarball with the changed tests at
> http://schlueters.de/~johannes/php/zend_package_tests.tar.bz2
> 
> johannes

---

## #31681 — David Coallier — 2007-08-17T14:30:29+00:00

URL: https://externals.io/message/31509#31681 · In reply to: #31680

Great stuff man! :) Thanks


> Hi,
>
> I've updated the patch to be compatible with Dmitry's latest changes:
> http://schlueters.de/~johannes/php/zend_namespace_to_package_20070817.diff
>
> johannes
>
> 
> > […]
>
> --
> 
> 
>
>


-- 
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18

---

## #31682 — Richard Quadling — 2007-08-17T15:06:55+00:00

URL: https://externals.io/message/31509#31682 · In reply to: #31680

Oh dear. I thought the general feeling was to stick with namespaces?


> Hi,
>
> I've updated the patch to be compatible with Dmitry's latest changes:
> http://schlueters.de/~johannes/php/zend_namespace_to_package_20070817.diff
>
> johannes
>
> 
> > […]
>
> --
> 
> 
>
>


-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

---

## #31683 — Ilia Alshanetsky — 2007-08-17T15:11:57+00:00

URL: https://externals.io/message/31509#31683 · In reply to: #31682

While PHP implementation of namespaces is may not be 100% of what  
people consider to be namespaces it is close enough and I think the  
name "namespaces" is most appropriate and clear cut. We don't call  
PHP objects "Zend Objects" or some other strange name, I don't see  
why namespaces should be any different IMHO.




> Oh dear. I thought the general feeling was to stick with namespaces?
>
> 
> > […]
>
>
> -- 
> -----
> Richard Quadling
> Zend Certified Engineer : http://zend.com/zce.php? 
> c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"

Ilia Alshanetsky

---

## #31684 — David Coallier — 2007-08-17T15:18:23+00:00

URL: https://externals.io/message/31509#31684 · In reply to: #31683

> While PHP implementation of namespaces is may not be 100% of what
> people consider to be namespaces it is close enough and I think the
> name "namespaces" is most appropriate and clear cut. We don't call
> PHP objects "Zend Objects" or some other strange name, I don't see
> why namespaces should be any different IMHO.
>

If we start calling things what they are, then we might as well do it
for the *namespaces* as well ? So ccall them package. And Stanislav,
it's not only because java does it that way, it's because python also
does, and also because c++ doesn't.

After all, why discussing the color of the bikeshed when it's already
painted and it's a dogshed ?
>
> 
>
> > […]
>
> Ilia Alshanetsky
>
> --
> 
> 
>
>


-- 
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com)
51.42.06.70.18

---

## #31686 — Ilia Alshanetsky — 2007-08-17T15:29:26+00:00

URL: https://externals.io/message/31509#31686 · In reply to: #31684

David,

Most people don't know wtf you are referring to by "package", but  
nearly everyone knows the concept of namespaces. Packages is name for  
an implementation of namespaces, calling it packages just because  
language XYZ that I like, does not sound like the best of ideas.




> 
> > […]
>
> If we start calling things what they are, then we might as well do it
> for the *namespaces* as well ? So ccall them package. And Stanislav,
> it's not only because java does it that way, it's because python also
> does, and also because c++ doesn't.
>
> After all, why discussing the color of the bikeshed when it's already
> painted and it's a dogshed ?
> > […]
>
>
> -- 
> David Coallier,
> Founder & Software Architect,
> Agora Production (http://agoraproduction.com)
> 51.42.06.70.18

Ilia Alshanetsky

---

## #31687 — Guilherme Blanco — 2007-08-17T15:56:42+00:00

URL: https://externals.io/message/31509#31687 · In reply to: #31686

Again, you are trying to use a keyword based on what developer's most
know. You want to release a sort of namespace implementation and
frustrate users, that expect a true namespace implementation.

I'd like that language MyPersonalFckinLang implemented it. Everything
in this discussion is motivated by Java does this or C++ or C# or
Python does that.

One package is a specific implementation of namespace which,
unhappilly was incorporated by Java. One package ***IS*** a namespace,
but applies restrictions. WTF? Yes, look at PHP... it's a kind of
namespace implementation (ah packages too), and apply restrictions
(one package per file) (ah, packages too, but namespaces allow more
than one per file).

For your announcement, "PHP has namespace support provided by packages."

I am not the bad guy in this entire history, and I hope we can drink a
dozen bottles of beer =) together in the future, but PLEASE don't
frustrate PHP users by providing them a basic functionality of what
you have announced.

The filescope is another workaround for namespace implementation. One
namespace local import should work in the entire namespace, not only
in the file it was imported.

AGAIN, here are the list of changes that will make everyone accept
namespace as the keyword:

- 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.


If you say these functionalities will be implemented (ok, maybe in
PHP6.1 or 6.X), I'd change my vote and I'll fight in the namespaces
side. I think not only me, but everyone that is currently suggesting
to rename it to packages.
I can even try to help in the development of them, but I'll need some
help to understand the background of ZE. Sara's book will arrive at
home in 4-6 weeks.


Regards,


> David,
>
> Most people don't know wtf you are referring to by "package", but
> nearly everyone knows the concept of namespaces. Packages is name for
> an implementation of namespaces, calling it packages just because
> language XYZ that I like, does not sound like the best of ideas.
>
>
> 
>
> > […]
>
> Ilia Alshanetsky
>
> --
> 
> 
>
>


-- 
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

---

## #31708 — Stanislav Malyshev — 2007-08-17T17:46:44+00:00

URL: https://externals.io/message/31509#31708 · In reply to: #31687

> Again, you are trying to use a keyword based on what developer's most
> know. You want to release a sort of namespace implementation and
> frustrate users, that expect a true namespace implementation.

Please stop doing this. PHP namespace implementation is as "true" as it 
gets, even in current form (which of course might be changed, extended, 
etc. but it doesn't make it less true).
If you have any specific feature missing (except for braces which were 
discussed already in length so please mention them _only_ if you have 
something new to say about it) - this is exactly the time to say it, 
since we are still in prototyping stage, so please do bring it forward. 
  But please do not just decry it because it uses slightly different 
syntax than some other language you know.
-- 
Stanislav Malyshev, Zend Software Architect
stas@zend.com   http://www.zend.com/
(408)253-8829   MSN: stas@zend.com

---

## #31714 — scott lewis — 2007-08-18T00:47:57+00:00

URL: https://externals.io/message/31509#31714 · In reply to: #31708

> > […]
>
> Please stop doing this. PHP namespace implementation is as "true"  
> as it gets, even in current form (which of course might be changed,  
> extended, etc. but it doesn't make it less true).

I think you've missed his point. He's not talking about the abstract  
concept of namespaces. He's talking about specific language features  
accessed via the keyword 'namespace'.

The core of the argument to rename is that using the keyword  
'namespace' will confuse developers who have experience with that  
keyword in other languages, since PHP does not match the most common  
syntax (C++). This is completely separate from whether the PHP  
language feature is a good implementation of the abstract namespace  
concept. The keyword does not define the feature -- the keyword  
defines _expectations_ about the keyword.


PHP is getting a namespaces feature -- this is excellent. Giving it  
the same keyword as a syntax-incompatible feature of other languages  
is going to cause confusion -- that's bad.


Now, the keyword 'package' has similar problems, but to a much  
smaller degree since the syntax of the PHP language feature is  
similar to that of the Java feature. Still, any confusion is best  
avoided so 'package' should probably join 'namespace' on the pile of  
rejected keywords.

'prefix', as suggested in the other thread, seems to nicely describe  
the concept and would still describe the concept if the feature was  
extended out to full-on C++- or Java-style syntax. And I can't think  
of any languages with a confusingly similar keyword.

scott.

---

## #31731 — Marcus Boerger — 2007-08-20T10:17:20+00:00

URL: https://externals.io/message/31509#31731 · In reply to: #31708

Hello Stanislav,

  interesting, we are still in prototype form....hmmm since when do we
commit proto types? I thought we are supposed to show patches until they
work as expected. So remembering the other new mails you guys wrote
recently....we might drop all of this again, we might rename all of it, we
might replace it completley... what the hell is going on here?

marcus

Friday, August 17, 2007, 7:46:44 PM, you wrote:

> > […]

> Please stop doing this. PHP namespace implementation is as "true" as it 
> gets, even in current form (which of course might be changed, extended, 
> etc. but it doesn't make it less true).
> If you have any specific feature missing (except for braces which were 
> discussed already in length so please mention them _only_ if you have 
> something new to say about it) - this is exactly the time to say it, 
> since we are still in prototyping stage, so please do bring it forward. 
>   But please do not just decry it because it uses slightly different 
> syntax than some other language you know.
> -- 
> Stanislav Malyshev, Zend Software Architect
> stas@zend.com   http://www.zend.com/
> (408)253-8829   MSN: stas@zend.com




Best regards,
 Marcus

---

## #31738 — Stanislav Malyshev — 2007-08-20T17:09:34+00:00

URL: https://externals.io/message/31509#31738 · In reply to: #31731

>   interesting, we are still in prototype form....hmmm since when do we
> commit proto types? I thought we are supposed to show patches until they
> work as expected. So remembering the other new mails you guys wrote
> recently....we might drop all of this again, we might rename all of it, we

I don't think it's likely we drop it, as for renaming - wasn't it you 
who pushed for it? :) I'm all for leaving it as it is :)

> might replace it completley... what the hell is going on here?

Complex opensource project development? Frankly, I don't know how many 
people would even look at it if it was only in patch form - it's very 
big and complex patch.
-- 
Stanislav Malyshev, Zend Software Architect
stas@zend.com   http://www.zend.com/
(408)253-8829   MSN: stas@zend.com
