Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84436 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4366 invoked from network); 8 Mar 2015 14:03:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Mar 2015 14:03:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wg0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:44639] helo=mail-wg0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/43-17427-AC65CF45 for ; Sun, 08 Mar 2015 09:03:55 -0500 Received: by wghl18 with SMTP id l18so15415556wgh.11 for ; Sun, 08 Mar 2015 07:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=2nbmZApRD/2ejWARhli2XEZo9gaNePChyv7IDDBgthk=; b=wmPBGxl8gZy9spvgG5Ajq4ip2+MZBKX7fSkvukL88VUfxJBp47vBs3SsYpIWusLlBC FcoYSZuBwXBrl5bIdnLeaEUVC5fLcL9KIuqT1yIDuT8PU0S8mPpO+4NES2ash1lwxi1Q 85j0kaurHIf5E5KimeWGyMVDvbfz7O3ur316UvPWquiNHRUKaQchaTwz0vl7tP6jtyd7 mSqKJVclxFECSB4ViRZdj7VR719blWXA8zg8C5Ysn0myKGJSb42UM5umvTPYK3y05GNJ QvQBdVPE9qT4V5BFQHEa1FyncqTVRYzzCOgXL0jhzXI+sbLdO3o7uRvusI7kKMEx/WzA V/Ig== X-Received: by 10.194.9.98 with SMTP id y2mr49611664wja.85.1425823431700; Sun, 08 Mar 2015 07:03:51 -0700 (PDT) Received: from [192.168.0.5] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id gi9sm27964979wib.21.2015.03.08.07.03.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Mar 2015 07:03:51 -0700 (PDT) Message-ID: <54FC56AE.3000601@gmail.com> Date: Sun, 08 Mar 2015 14:03:26 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: internals@lists.php.net References: <54F440E6.4050908@gmail.com> <54F48108.6010000@gmail.com> <54F6D96B.7000900@lsces.co.uk> In-Reply-To: <54F6D96B.7000900@lsces.co.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Feature request and RFC From: rowan.collins@gmail.com (Rowan Collins) On 04/03/2015 10:07, Lester Caine wrote: > On 04/03/15 09:41, Rowan Collins wrote: >> Hm, yes, I hadn't thought of the use case of sorting external data. Perhaps we actually need to specify both interfaces (yes, I realise I'm just inventing more work here, sorry!) - one for the use case of a custom data structure that wants to worry about the sort mechanics but not the ordering, and one for the different use case of wanting to sort something other than PHP values. I strongly believe that making the first type of object reimplement 11 types of comparison callback which the engine already has is a bad idea. > I'd been following this thread, but only from a distant need. I tend to > be working with lists pulled directly from a database, and Firebird > allows the selection of collation rules to take care of the bulk of the > problems this interface is also trying to address. This option allows > all of the complication created by unicode to be addressed and a ready > sorted array is provided. The starting point for a generic approach > needs to be based on a unicode rule set which currently we do not have a > standard for. ICU provides a collation system in parallel with the > database standards and if the ICU based string object is adopted then > sort interfaces need to be based on that. Actually, collation is an interesting point - of all the different sort functions in current PHP, none of them really considers it. That's a disadvantage of passing the flags through to the collection being sorted, rather than the comparison implementation - it's very hard for us to change the underlying set of sort options without a BC break on the interface, because they're so closely coupled. For remote data sources, they'd need a new argument or method to accept and act on the new options; for simple data structures, they'd want to just use the new comparison type. Like so many things, it's probably a good idea to consider up front the kinds of use cases we're targeting, and those that we're not, otherwise we end up with an implementation that is very well-engineered in itself, but doesn't actually meet people's needs. Regards, -- Rowan Collins [IMSoP]