hi Adam, Thanks for writing and updating a RFC, always the best way to propose new features :)
On Fri, Oct 1, 2010 at 10:38 AM, Adam Harvey <ahar...@php.net> wrote: > On 30 September 2010 21:33, Adam Harvey <ahar...@php.net> wrote: >> I've just written an RFC (with a patch against trunk) to implement a >> Comparable interface similar to that in Java — in effect, allowing >> object instances to be compared with semantics defined in userspace. >> This is admittedly at the lower end of RFC-worthy proposals, but it's >> a good system, and I'd like to see it used a little more. Plus, it's >> good practice for the more interesting stuff to come. :) > > I've updated the RFC with a fresh patch that doesn't involve SPL at > all and attempted to incorporate some of the questions and answers so > far into the RFC. I've also added a section for concerns with the RFC; > I've attempted to distil the concerns I've seen so far, but please > feel free to edit that list if specific concerns are misrepresented or > unrepresented. Maybe to get a context about how other languages work (or do not work) with these similar features, it could be interesting to look at the python (2.5) documentation: http://docs.python.org/release/2.5.2/ref/customization.html As I would be in favor of having a compareTo interface for similar objects, I worry a bit about comparing apple and pear. Yes, an apple can be greater than a pear in real world but the wtf is somehow huge in a php context. That's why I share Stas or Gustavo thoughts about comparing instances of different classes (or with inheritance from internal classes without a comparable implementation). To be more precised, by "wtf", I mean that $a == $b may not mean that $b == $a (as in python for example). That's something we should consider carefully. Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php