Re: Re: [PHP6] Function name consistency

From: Date: Fri, 24 Jan 2014 20:38:07 +0000
Subject: Re: Re: [PHP6] Function name consistency
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On 1/24/14 2:27 PM, Yasuo Ohgaki wrote:

Agreed. Simply aliasing a bunch of functions offers no useful value, but does increase confusion. ("Wait, do I use strcmp() or string_compare() on this project? What version are we on again? Oh, look, this library uses both. Must have been different devs. FML.") If we're going to do anything, be aggressive and far-reaching with it. Build a proper language-level OOP design for string/array manipulation. We have enough functions lying about. Don't add more.
We should be careful choosing names. I agree. However, not adding more function names is simply impossible. For example, I'm about to add new session function named string session_create_id([string $prefix]) for user save handlers, so that user could generate secure ID easily. It's a straight name for session ID creation and there might be users using this name. Not adding any new names means not adding any new features nor cleanups. Regards,
I don't mean "never add a function again". I mean adding functions for no particular value other than having more of them helps nothing, and arguably makes the situation worse. Where possible, we shouldn't be adding yet-another-utility-function but looking to how to build more complete and functional language capabilities and standard libraries, rather than piecemeal addition of functions one RFC at a time. For your example, for instance, session handling is as of PHP 5.4 an object. That's the cleaner way to handle it than a bunch of functions. Can that function be better integrated into an API rather than just added to a long list of tools? I don't know; maybe. But we should be asking those questions, not saying "how many more ways to type strcmp() can we introduce to confuse people." --Larry Garfield

Thread (46 messages)

« previous php.internals (#71528) next »