Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67351 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95745 invoked from network); 7 May 2013 19:31:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 May 2013 19:31:02 -0000 Authentication-Results: pb1.pair.com smtp.mail=zelnaga@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=zelnaga@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.172 as permitted sender) X-PHP-List-Original-Sender: zelnaga@gmail.com X-Host-Fingerprint: 209.85.212.172 mail-wi0-f172.google.com Received: from [209.85.212.172] ([209.85.212.172:49806] helo=mail-wi0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/A4-06696-57659815 for ; Tue, 07 May 2013 15:31:01 -0400 Received: by mail-wi0-f172.google.com with SMTP id hm14so4176757wib.5 for ; Tue, 07 May 2013 12:30:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=qeSAjY78mfhQv81StJTrH5gGZPYZU2SQCjCz0l9JHPk=; b=0Cucvqnw4WjkJb5UatcwAMxkDk7lIvrWeskd8hcGA3XowsNhCT2OaqpMVOc65ZpClf K96NH1bMzYiXbVP2RMqHzU2bIdVx4elhnGUT6zbIRq3HKWvsyHCAhYFfoCOJFQNoLoo0 y60DPuewS4NcW2aPtWPvncotFV+KRsAiAqh6G+V91105uZjZWqa9tJMsjEdgtPur9RLP fFEkqHfPC9zA7zH+U8WjwuiLArt7+zZhJF3adgLVjClleNRKQtzWVBUIP1pvK1c6my0A ftpKL3xI8cbgDULy4ykxWWQrZKBjaRPoORqEYeuvpyBL7l/dQX8OF3fmeoP3XN43bJDE +pqQ== MIME-Version: 1.0 X-Received: by 10.180.160.200 with SMTP id xm8mr5516765wib.23.1367955058126; Tue, 07 May 2013 12:30:58 -0700 (PDT) Received: by 10.194.77.48 with HTTP; Tue, 7 May 2013 12:30:58 -0700 (PDT) In-Reply-To: References: Date: Tue, 7 May 2013 14:30:58 -0500 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7b6250204ef66104dc25db54 Subject: Re: [PHP-DEV] idea: implement a Comparable interface From: zelnaga@gmail.com (Thomas Anderson) --047d7b6250204ef66104dc25db54 Content-Type: text/plain; charset=ISO-8859-1 On Tue, May 7, 2013 at 1:05 PM, Nikita Popov wrote: > On Tue, May 7, 2013 at 6:17 PM, 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. >> > > Do you have examples of what this would be useful for? The two things that > come to mind are DateTime (which can do this anyway as it's an internal > class) and classes for bignums or something like that (which are probably > also better implemented internally). So I'm not sure how much use there is > for this. > bignum PHP class: http://phpseclib.sourceforge.net/math/intro.html Per the benchmarks it's internal implementation (without OpenSSL) is faster than BCMath is in 5.4 lol. Not sure which OS the test was ran on. That's the only use case I can come up with off the top of my head but that's more than I can come up with for Iterator atm lol. --047d7b6250204ef66104dc25db54--