Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83685 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 32804 invoked from network); 24 Feb 2015 19:20:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Feb 2015 19:20:46 -0000 Authentication-Results: pb1.pair.com header.from=thomas@gielfeldt.dk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=thomas@gielfeldt.dk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain gielfeldt.dk from 209.85.215.45 cause and error) X-PHP-List-Original-Sender: thomas@gielfeldt.dk X-Host-Fingerprint: 209.85.215.45 mail-la0-f45.google.com Received: from [209.85.215.45] ([209.85.215.45:43441] helo=mail-la0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/61-24698-B0FCCE45 for ; Tue, 24 Feb 2015 14:20:44 -0500 Received: by labhv19 with SMTP id hv19so5349818lab.10 for ; Tue, 24 Feb 2015 11:20:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=QBBrTuroFisvp+9oBfQ8Br+gl6B/rey7FPGRgpeexH4=; b=B8x2OpeouU++ruho2FTGx0KQFSboRf9oqDio7ZMnStToqvk571X3flBBv223S74ZJL fr6WQEmV46osWxr1uLAi/JieYfh82ww9TER47hUjkIquAz/Fc7hM2V7MVuW/GwgorUP8 t97c+8wafbR6cn/9t3+ZH8PToehh47WMbvLk/wi0Cl58KLmj+CelNWzXEWL1tgQZiPal PfpYwQW5HaNSQpayTQY+M+1KEkGJuJXrfTqsdBkVTVPUt/pTLLOepiTYJQOmNyicpUL5 W4UhQJAE/NMLp6Kjb2USYF1EyFNhDdXQqB/zX8+f3IMgWrmSuTi7KodHvZiAavn5XTH1 8JRg== X-Gm-Message-State: ALoCoQm1j5aZHO+5TdCwjoSVdCNtikQW0bfTIp+9WkRSt8ze5WhZdJT/ehFgfpAmYbyfRnYS8Y63 X-Received: by 10.112.182.69 with SMTP id ec5mr15099722lbc.118.1424805640599; Tue, 24 Feb 2015 11:20:40 -0800 (PST) MIME-Version: 1.0 Received: by 10.152.144.194 with HTTP; Tue, 24 Feb 2015 11:20:19 -0800 (PST) In-Reply-To: References: Date: Tue, 24 Feb 2015 20:20:19 +0100 Message-ID: To: Benjamin Eberlei Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11c3686e15111a050fda6a47 Subject: Re: [PHP-DEV] Feature request and RFC From: thomas@gielfeldt.dk (Thomas Gielfeldt) --001a11c3686e15111a050fda6a47 Content-Type: text/plain; charset=UTF-8 2015-02-24 17:36 GMT+01:00 Benjamin Eberlei : > Hi, > > On Tue, Feb 24, 2015 at 5:17 PM, Thomas Gielfeldt > 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 >> > > --001a11c3686e15111a050fda6a47--