<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Johan&#039;s Blog &#187; namespace</title>
	<atom:link href="http://blog.johan-mares.be/tag/namespace/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.johan-mares.be</link>
	<description>A personal blog</description>
	<lastBuildDate>Sun, 24 Oct 2010 15:08:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHP namespace separator</title>
		<link>http://blog.johan-mares.be/ict/php/php-namespace-separator/</link>
		<comments>http://blog.johan-mares.be/ict/php/php-namespace-separator/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 09:37:15 +0000</pubDate>
		<dc:creator>Johan</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[namespace]]></category>

		<guid isPermaLink="false">http://blog.johan-mares.be/?p=41</guid>
		<description><![CDATA[I honestly thought that the namespace separator for PHP was a done deal, namely '::'.  It was originally planned to introduce namespaces in PHP6, but they moved it to the upcoming PHP 5.3 and due to problems implementing that they made a last minute change to '\'.
A lot of people are happy that PHP will finally have support for namespaces, but a lot of people also think they made a really bad choice for the separator.]]></description>
			<content:encoded><![CDATA[<p></p><div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.johan-mares.be%2Fict%2Fphp%2Fphp-namespace-separator%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.johan-mares.be%2Fict%2Fphp%2Fphp-namespace-separator%2F&amp;source=maresjohan&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I honestly thought that the namespace separator for PHP was a done deal, namely &#8216;::&#8217;.  It was originally planned to introduce namespaces in PHP6, but they moved it to the upcoming PHP 5.3 and due to problems implementing that they made a last minute change to &#8216;\&#8217;.</p>
<p>A lot of people are happy that PHP will finally have support for namespaces, but a lot of people also think they made a really bad choice for the separator.<span id="more-41"></span><br />
One of the best comments I found was on <a title="PHP Gets Namespace Separators, With a Twist " href="http://developers.slashdot.org/article.pl?sid=08/10/26/1610259" target="_blank">slashdot</a> and it gives an overview of the separators for different programming languages:</p>
<pre>Java:
Attribute/Method access: foo.bar
Static method access:    Foo.bar
Package access:          foo.bar.baz

C#:
Attribute/Method access: foo.bar
Static method access:    Foo.bar
Namespace access:        foo.bar.baz

Python:
Attribute/Method access: foo.bar
Static method access:    Foo.bar
Module access:           foo.bar.baz

PHP:
Attribute/Method access: $foo-&gt;bar
Static method access:    Foo::bar
Namespace access:        foo\bar\baz</pre>
<p>My thoughts about this:</p>
<ul>
<li>it makes PHP look inconsistent</li>
<li>it makes the introduction of namespaces in PHP look like a rush job, improvisation, some quick and dirty programming</li>
<li>if they encountered serious problems introducing namespaces in PHP 5.3, they should have postponed it to PHP6, like originally planned</li>
<li>it feels weird using a backslash on the left side of an assignment operator</li>
<li>it looks ugly</li>
</ul>
<p>I don&#8217;t think I will be using namespaces anytime soon, because I will be using PHP 5.1.6 at work and PHP 5.2.5 on this shared hosting for a while longer, but when I have to I will just go with the flow like everybody else. Unless you choose for poor man&#8217;s namespacing (and be using very long classnames).</p>
<p>Just my 0.02 €</p>
<table style="border: medium none; margin: 20px auto; width: auto;" border="0" align="center">
<tbody>
<tr>
<td>Trying to please everybody,<br />
you&#8217;ll please no one.</td>
</tr>
<tr>
<td align="right"></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://blog.johan-mares.be/ict/php/php-namespace-separator/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching 2/10 queries in 0.004 seconds using disk: basic
Object Caching 312/321 objects using disk: basic

Served from: blog.johan-mares.be @ 2012-02-06 06:20:22 -->
