The eclectic musings of a bitter software engineer.

PHP is a wonderfully flexible and powerful language, but it's notorious for having a very polluted global namespace and no way to define separate namespaces other than wrapping things in classes. Users have been begging for a better solution for years, but to no avail. It looks like that may finally change, though.

The release of PHP 5.1.0 just before Thanksgiving introduced a new native Date class for (not surprisingly) manipulating dates and times. Unfortunately, PHP's developers either didn't notice or didn't care that there was already a very popular PEAR class called Date. So anyone who was using the PEAR Date class and upgraded to PHP 5.1.0 suddenly found themselves using an entirely different and incompatible native Date class, which broke hundreds, if not thousands, of applications.

The PHP mailing lists were instantly abuzz with users complaining about the breakage and developers proposing half-baked ideas for solving the problem by — at long last — introducing namespaces. Thankfully, cooler heads realized that namespaces are a big change and the most important thing was to fix the immediate problem, so PHP 5.1.1 was quickly released minus the new Date class.

This incident seems to have hammered home to the PHP team just how important namespaces are and how painful it is to try and design a language as big as PHP without them. Maybe after this they'll finally get their shit together and add namespaces in PHP 6.

Comments

The "snow" namespace, which is used when defining "sledding," "cold white stuff," "snow flakes," and today it also defines what is distracting me out my office window. Now if some fool will try (and fail) to drive up the sledding hill, my entertainment will be complete.

Tuesday November 29, 2005 @ 09:42 AM (PST) Posted by sul
This was discussed in some pre-PHP5 threads awhile ago, and it was decided that they were going to wait until PHP6.

Im also waiting for namespaces too
Friday December 02, 2005 @ 04:18 PM (PST) Posted by symlink

When they develop PHP 6, I hope the developers forget backwards compatability and move forwards to a fully object oriented approach with standardised naming conventions.

I hate it when I have to look at the manual to remember what naming convention they use, underscore_spaced - nospaces - camelHump. I prefer camel hump personally because it is used in Java.

Namespaces are just as annoying as lack of naming standards, and I also don't like mixing functions with objects all the time.

I also hope they make strings be passed by references automatically like they do with arrays and objects. Maybe I have been using Java too much but in a perfect world I would never have to worry about whether to pass a string/array/object by reference or not for performance purposes. If programmers want a copy of it, let them create one themselves.

Tuesday January 31, 2006 @ 06:43 PM (PST) Posted by Seekz
Post a comment

Basic XHTML (including links) is allowed, just don't try anything fishy. Your comment will be auto-formatted unless you use your own <p> tags for formatting. You're also welcome to use Textile.

Don't type anything here unless you're an evil robot:


And especially don't type anything here:

Copyright © 2002-2008 Ryan Grove. All rights reserved.
Powered by Thoth.