Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67361 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11376 invoked from network); 7 May 2013 20:33:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 May 2013 20:33:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.99 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.99 smtp99.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.99] ([108.166.43.99:35890] helo=smtp99.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/E7-06696-D2569815 for ; Tue, 07 May 2013 16:33:50 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp5.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id F31C81B00E6; Tue, 7 May 2013 16:33:46 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp5.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 6137D1B0098; Tue, 7 May 2013 16:33:46 -0400 (EDT) Message-ID: <51896529.4030408@sugarcrm.com> Date: Tue, 07 May 2013 13:33:45 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: Adam Harvey CC: Thomas Anderson , PHP internals References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] idea: implement a Comparable interface From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > I wrote https://wiki.php.net/rfc/comparable a couple of years ago — > 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). Overriding < and > isn't the biggest issue, even though BC issues with conversions may definitely be a surprise. Bug biggest one is ==, which may have a lot of very non-trivial effects if you make == return "equals" when other functions (such as searches, hashes, etc.) may treat them as not equal. It is quite a complex thing which is rife with unexpected side effects, so I think it would be better if it were explicit. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227