Re: Re: [PHP6] Function name consistency

From: Date: Fri, 24 Jan 2014 20:49:41 +0000
Subject: Re: Re: [PHP6] Function name consistency
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-71530@lists.php.net to get a copy of this message
Hi Larry,

On Sat, Jan 25, 2014 at 5:38 AM, Larry Garfield <larry@garfieldtech.com>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."


I think we have different objective.

 - Better PHP for *future* users.
vs
 - Better PHP for *current* users.

Both objectives are important, IMHO.
My intention is to make/keep PHP attractive language to learn.

We have namespace, so name collision is not much issue
now a days, isn't it? I know there are many apps w/o namespace,
though. There is a way to work round at least.

Regards,

--
Yasuo Ohgaki
yohgaki@ohgaki.net


Thread (46 messages)

« previous php.internals (#71530) next »