Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67341 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78867 invoked from network); 7 May 2013 18:01:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 May 2013 18:01:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.223.174 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.223.174 mail-ie0-f174.google.com Received: from [209.85.223.174] ([209.85.223.174:60756] helo=mail-ie0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/21-06696-A6149815 for ; Tue, 07 May 2013 14:01:14 -0400 Received: by mail-ie0-f174.google.com with SMTP id 10so1513194ied.19 for ; Tue, 07 May 2013 11:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=834aXKqSYBaybQQNE0iRmQoLj0THmbUdNgznp1MjPj8=; b=EeuxijcrDYFHTr7PxZZRVaqzfeuHoerk2sFuAwZzMoX3vszXYi9CNQhQkCYW4dcbUk Hr4X9Jr2jVVwilVWNimJfW52xvC86rsNnUBpLqfhyBNerakcPUrlQkX2fa7AKriKgxEY RACXj35XqiXCGFk2LxKPZqHp1k9U61/IV7e3k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=834aXKqSYBaybQQNE0iRmQoLj0THmbUdNgznp1MjPj8=; b=FgjX81gYJw6WsIDdTCgEQy3t4KdFijQlHvxBe6fopKrZwdc1MI2l6Kg4GiuHL5JvLW N18o6qVd6JJzjECvKk1VeUA04gPDoRUw4qe3O/BVpyIVVeGItH5qKscoi910Vh+gfrdv evKGVpzsrNu8v5ZehUbvr+ydd7katgaah5I05nvsUtB27ALd+hmc/ktUtoo3ZZqdyDqB Mtd3dOn86qDC/GkSMcAvzC37J4Hs/2HK+6jxabzsHSLllq+sVCx1m9X6A60P4nSQjhKG SiHe2uED0l/P2PSuVNEYuQR4ADiER/CWTPOiQzDj+Yu8pn2HGpu5Pqv7ofgp6woe5cxC NdRQ== X-Received: by 10.50.18.74 with SMTP id u10mr1116689igd.42.1367949671902; Tue, 07 May 2013 11:01:11 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.42.146.65 with HTTP; Tue, 7 May 2013 11:00:51 -0700 (PDT) In-Reply-To: References: Date: Tue, 7 May 2013 11:00:51 -0700 X-Google-Sender-Auth: -wRx2SnmfAU0vICbRgzcWDg5UWw Message-ID: To: Thomas Anderson Cc: PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQklp1GJs94MtEPxVhuYp/LZCgje3jxNMXqBoajZ1RYjSUz1sRSVqpkExMnd0GrA+ggckLBE Subject: Re: [PHP-DEV] idea: implement a Comparable interface From: aharvey@php.net (Adam Harvey) On 7 May 2013 09:17, Thomas Anderson wrote: > It'd be nice if, when doing $objA > $objB, that that'd invoke > $objA->__compareTo($objB) or something, much like Java's Comparable > interface. I wrote https://wiki.php.net/rfc/comparable a couple of years ago =E2=80=94 there's a patch there that would probably still apply without too much work to master. About the only difference was that I didn't double underscore the magic method (in line with both Java and PHP interfaces like Countable). I ended up withdrawing it because the response at the time was somewhere between "meh" and "outright hostility"; I didn't see much point devoting time to something that was going to fail a vote regardless. It could be dusted off and reproposed for 5.6 if there was enough interest, but my guess is that it'd still be an uphill battle (even though some internal classes, most notably DateTime, do exactly this). Adam