Re: RFC: Comparable interface
| From: | Derick Rethans | Date: | Thu, 30 Sep 2010 14:47:30 +0000 |
| Subject: | Re: RFC: Comparable interface | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49816@lists.php.net to get a copy of this message | ||
On Thu, 30 Sep 2010, Johannes Schlüter wrote:
> On Thu, 2010-09-30 at 21:33 +0800, Adam Harvey wrote:
> > All,
> >
> > 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. :)
>
> What is this "more interesting stuff to come"? - currently it is a bit
> syntactic sugar, one might argue a feature which makes reading code
> harder(*), and we are careful with adding such.
>
>
> (*) Right now it is quite clear what happens if you read
> $a == $b
> there are a few edge cases (0 == "100000 mails ina thread") but overall
> quite clear. With your patch "anything" might happen, which is hard to
> detect as we don't enforce strong typing, which would give a hint.
It sounds a little bit like operator over loading to me...
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug