Re: Consistent function names
| From: | Yasuo Ohgaki | Date: | Tue, 10 Mar 2015 20:44:14 +0000 |
| Subject: | Re: Consistent function names | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-84519@lists.php.net to get a copy of this message | ||
Hi Lester,
On Tue, Mar 10, 2015 at 6:27 PM, Lester Caine <lester@lsces.co.uk> wrote:
> On 10/03/15 01:59, Yasuo Ohgaki wrote:
> > The same argument applies to fresh new OO APIs. It's just a matter of
> > targeted PHP version to be supported. There are many things to be
> > considered to decide targeted PHP version other than this RFC. We have
> many
> > new features/behaviors in newer PHP versions.
>
> I still have a major problem with the whole basis of your re-naming ...
> adding the underscore at all. It was this introduction which was totally
> wrong in the first place and I would rather rename the incorrectly
> renamed functions if only to make them consistent with what is used in
> the OO 'standard'.
>
> $main->phpVersion()
> or
> phpversion()
>
> Is consistent if one maintains the case insensitive rule.
>
> Adding str_ in front of every string function where a lot are IEEE
> protected is just adding confusion. Where these map to an OO API in my book
>
> strcmp()
> $str->cmp()
>
> makes sense?
> Adding an extra $str_cmp is simply not necessary.
>
> Simply dropping the poorly formulated 'add underscore' rule which only
> currently exists on the procedural interface and tidying up the mistake
> caused by that produces a MUCH shorter list of changes and allows much
> better consistency with even the existing OO interface elements?
>
> I look at the 'tidy' gd interface and simply think 'what the ****'
>
> Yes there are some inconsistent names, but in general
> imagecolorallocate
> and
> $image->colorAllocate
>
> is more in keeping with the other graphics libraries.
>
> YES there is room to create a more consistent procedural interface, but
> my original question still applies "consistent with what rules?"
It's possible choice.
I agree that names without "_" looks more consistent.
Personally, I don't care much about having "_" or not for procedural API. My
only concern is naming consistency.
Names without "_" changes basic coding rule.
Problem is how to make a choice and how to define exceptions. e.g.
nl_langinfo()
I wonder how many of us prefer names without "_".
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net