Many of you have already heard the PHP news. The rest of you may have wondered what that strange sound was. That was the sound of tens of thousands of developer's jaws dropping all at once. You see, PHP is getting namespaces and the delimiter is the backslash. Yup. The backslash: '\' (minus the quotes, obviously).
Apparently they were all set to go with the double-colon '::' separator when someone pointed out that this is what they use to call a static class function in PHP:
BloodyToys::giggle();
Uh oh. Now what do you do? Is "BloodyToys" a class or a namespace? In the Perl world, this might seem like a non-issue because unlike many other languages, we don't make a distinction between classes or namespaces. PHP does and this makes parsing problematic. I suppose that PHP could have simply died at compile-time if they found an ambiguous declaration (e.g., a giggle function defined in both a BloodyToys namespace and a BloodyToys class), but the developers decided not to do this and frankly, I have no idea why.
For more on this, I one PHP developer's comments on the new namespace decision. It will be interesting to see what comes of this.
<rumour mode="joke">I heard that Microsoft bunged them a load of cash to make PHP namespaces look like Windows paths...</rumour>
The old package delimiter was a single quote, but double colon is now the preferred delimiter, in part because it's more readable to humans, and in part because it's more readable to emacs macros. — perlmod
-Dom
Re:People in glass houses…
chromatic on 2008-10-26T17:18:07
I hear that Perl's parser (for all of its complexity and maintenance horrors) is much more robust than PHP's parser. Ambiguity of parsing and difficulty of implementation are not primary concerns for Perl.
Re:People in glass houses…
pudge on 2008-10-30T23:00:04
use D'oh; #
:-D