Re: RFC: Comparable interface
| From: | Adam Harvey | Date: | Thu, 30 Sep 2010 14:57:41 +0000 |
| Subject: | Re: RFC: Comparable interface | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49818@lists.php.net to get a copy of this message | ||
(Omnibus reply, since Johannes's original e-mail hasn't yet dropped
into my ever-so-flaky mail setup. I have read it in full on
news.php.net, though.)
> On Thu, 30 Sep 2010, Johannes Schlüter wrote:
>> What is this "more interesting stuff to come"?
Nothing that's likely to be ready before the forthcoming release
cycle. I really did just want the RFC writing practice, since I
haven't done one within PHP's structure before. :)
>> (*) 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.
Sure, but I think by that argument interfaces like Countable,
Traversable and ArrayAccess would be out too. It is syntactic sugar,
but I think it's useful syntactic sugar.
One of the examples I toyed with tossing into the RFC was a date
class, but I figured the argument against that is the obvious one of
"people would use DateTime anyway". I think there are a range of
potential uses here.
2010/9/30 Derick Rethans <derick@php.net>:
> It sounds a little bit like operator over loading to me...
I guess it is in a sense, since the comparison operators are by
definition operators. I don't really see this is as starting any sort
of slippery slope towards a full operator overloading implementation,
though -- it's limited in scope, and really seems like a small,
logical feature to make objects a little bit more useful to me.
Adam