[RFC] Comparable
| From: | Fleshgrinder | Date: | Tue, 31 Jan 2017 22:48:25 +0000 |
| Subject: | [RFC] Comparable | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-98099@lists.php.net to get a copy of this message | ||
Hi :)
I have a few questions regarding the comparable RFC:
https://wiki.php.net/rfc/comparable
Couldn't find the thread in my history and thus cannot respond directly
to any of the past threads. Maybe not that bad after more than a year of
silence. :)
My question might sound silly but I am genuinely interested in the
explanation: why
compareTo and not comparedTo as method name? Is it
simply because of Java? To me it sounds kind of wrong:
if ($this->compareTo($other) === -1) { }
Especially if we add a nice Ordering Enum with some real behavior to the
game:
if ($this->compareTo($other)->isLess()) { }
Compare this to:
if ($this->comparedTo($other)->isLess()) { }
This gets close to what I would understand as proper English. Then again
there might be valid reasons for the former name that I am not aware of?!?
There are other things that I think should be added along with this RFC.
However, I need to investigate a bit further first before going into
detail here.
--
Richard "Fleshgrinder" Fussenegger