Re: Feature request and RFC
| From: | Thomas Gielfeldt | Date: | Tue, 24 Feb 2015 19:20:19 +0000 |
| Subject: | Re: Feature request and RFC | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-83685@lists.php.net to get a copy of this message | ||
2015-02-24 17:36 GMT+01:00 Benjamin Eberlei <kontakt@beberlei.de>:
> Hi,
>
> On Tue, Feb 24, 2015 at 5:17 PM, Thomas Gielfeldt <thomas@gielfeldt.dk>
> wrote:
>
>> Hi internals.
>>
>> I've made PR proposing a feature request: A new interface Sortable.
>>
>> https://github.com/php/php-src/pull/1116
>>
>> If possible, I would like to create and RFC describing this in more
>> detail,
>> and perhaps get a voting on.
>>
>
> so you need to implement all methods? This can probably be considered a
> violation of the Interface Segregation Principle. But adding an interface
> for each method seems a bit much as well.
>
Yeah, I've thought of this as well. PHP has got a load of sort functions.
I've also considered other options:
1.) 5 interfaces for, respectively, (r)sort, a(r)sort, k(r)sort, u(a|k)sort
and nat(case)sort, with 2-3 methods per interface.
2.) Same as above, but with a flag for reverse instead of a dedicated
function resulting in 5 interfaces with 1-3 methods each.
3.) 1 interface with 2 methods, sort() and usort(), and flags for reverse,
key and maintaining index.
I did consider the latter much, but wasn't sure if the methods would get
too monolithic.
I also did consider an interface per method. Briefly. :-)
>
>> Thanks
>>
>> Br,
>>
>> Thomas Gielfeldt
>>
>
>