Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101074 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97916 invoked from network); 7 Nov 2017 01:53:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2017 01:53:44 -0000 X-Host-Fingerprint: 95.150.123.149 unknown Received: from [95.150.123.149] ([95.150.123.149:23629] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EA/7D-09857-622110A5 for ; Mon, 06 Nov 2017 20:53:43 -0500 Message-ID: To: internals@lists.php.net References: <5e102e2e-5d5a-4eaa-822a-201671428fb1@gmx.de> Date: Tue, 7 Nov 2017 01:53:40 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 95.150.123.149 Subject: Re: [PHP-DEV] Re: Proposal: Rename image functions From: ajf@ajf.me (Andrea Faulds) Hi, Sara Golemon wrote: > On Sat, Nov 4, 2017 at 5:25 PM, Christoph M. Becker wrote: >> In my opinion, just renaming the functions doesn't make much sense. >> Instead we might consider to introduce OO wrappers, which wouldn't >> unnecessarily polute the global namespace, and also could lead to more >> concise userland code. Kalle's gdobjects[1] might serve as a base. >> > 100,000% this. > > Step 1: Transition the GD resource type to an object handle. > Step 2: Add methods to that object as aliases to the original functions. > Step 3: Profit. > > -Sara > OOP would be nice for avoiding having to type image* constantly. But as for the hard-to-read naming, OOP isn't necessaary, IMO. The current GD API's naming without underscores cries out for camelCase. And that's possible for methods… but it's also possible for functions! Both are case-insensitive, so in fact, you can already type GD function names in camelCase and the code will work. The problem here is we have a convention of writing global function names in the manual in lowercase, something we don't do for methods. The simple and pragmatic solution is to make an exception and document GD in camelCase, as God intended. (Probably.) -- Andrea Faulds https://ajf.me/