Re: idea: implement a Comparable interface

From: Date: Tue, 07 May 2013 18:00:51 +0000
Subject: Re: idea: implement a Comparable interface
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-67341@lists.php.net to get a copy of this message
On 7 May 2013 09:17, Thomas Anderson <zelnaga@gmail.com> 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 — 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

« previous php.internals (#67341) next »