[development] Time for a new chapter of an endless debate

Chris Johnson chris at tinpixel.com
Mon Jul 3 17:41:15 UTC 2006


Karoly Negyesi wrote:

> Drupal uses objects. Reasons are probably lost by now in the ancient past.
> 
> PHP is still not the best. I can write:
> 
> somefunction(array('this' => 'that'))
> 
> while there is no similar construct for objects.
> 
> Also we use arrays for links, menus, links and soon mails.
> 
> So, I propose removal of objects on practical grounds: shorter notation 
> and a very little memory gain.


> Ps. Readability issues? I do not think there is any difference.


I suspect that absent hair-splitting benchmarks, it really boils down to 
personal preferences.  (I personally prefer object syntax for a lot of 
situations over array syntax.)

To unilaterally forbid all use of object syntax for what will essentially be a 
very long time seems likewise a poor idea.  Especially if it is done on 
"religious" grounds, i.e. personal likes without significant, demonstrable 
benefits.

PHP5 is magnitudes better at object handling and provides a lot of OO power. 
Although most Drupal hosts may be on PHP4 now, they will not be in some short 
amount of time, perhaps 6 to 18 months.

Objects in PHP, even in PHP4, provide namespaces and there is currently no 
other way to do that in PHP.


And if I understand what you are trying to do above, you could write:
somefunction((object)array('this' => 'that'));

Perhaps not as terse or beautiful, but it works fine.


Count me as a -1 vote unless there are some good quantitative benefits that 
someone can show me.

..chris


More information about the development mailing list