Re: Re: Proposal: Rename image functions

From: Date: Tue, 07 Nov 2017 01:53:40 +0000
Subject: Re: Re: Proposal: Rename image functions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-101074@lists.php.net to get a copy of this message
Hi, Sara Golemon wrote:
On Sat, Nov 4, 2017 at 5:25 PM, Christoph M. Becker <cmbecker69@gmx.de> 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/

« previous php.internals (#101074) next »