Re: [PHP6] Function name consistency

From: Date: Thu, 02 Jan 2014 00:07:36 +0000
Subject: Re: [PHP6] Function name consistency
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-70950@lists.php.net to get a copy of this message
On 1/1/14, 3:26 PM, Rowan Collins wrote: > On 28/12/2013 08:43, Ralf Lang wrote: >> When redesigning for PHP6, shouldn't most functions move to a class or >> namespace in the first place? > > You make it sound like such a redesign is an obvious and achievable goal > for the next "major" release of PHP. Neither PHP 5 nor the abandoned PHP > 6 branch (Unicode strings, plus the features which were released as 5.3 > and 5.4 instead) attempted anything so radical, and the more you change, > the harder it is to persuade people to migrate. > > I suspect this has been discussed a lot of times, although I've only > joined the list recently. A search through the archives before taking > this discussion further would probably avoid repeating arguments that > have been had before, unless anyone has a good summary somewhere? > > Not that I'm against moving towards consistency per se, but I wouldn't > want to assume that whatever stopped it gaining traction in the past no > longer applies. You also need to realize that there is consistency. It is just consistency from a different angle. PHP from day one was always a very thin wrapper on top of dozens, now hundreds, of underlying libraries. The function names and argument order, for the most part, were taken directly from these underlying libraries. So if you were familiar with MySQL's C API, for example, you would instantly be able to navigate PHP's mysql functions to the point where we barely needed PHP MySQL documentation because MySQL's C library documentation covered it function for function. And for many of the str functions (the ones without an underscore), try typing: man strlen/strchr/strrchr/strtok/strpbr/strspn... at your Linux command line prompt. This approach covers the majority of the functions in PHP. The others are somewhat haphazard because it was not always obvious how to name these given there was no underlying API to mimic. So, whenever I see these, "let's just rename everything" posts, I never see the fact that most of these functions are deeply ingrained in the muscle memories of a lot of people addressed. And it is in our muscle memories, not because of PHP, but because we still live in a world written in C. As soon as you venture outside the world of PHP and scripting languages, you hit this world. That doesn't mean we can't try to address this, but simply renaming everything is not the answer. -Rasmus

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#70950) next »