Re: [RFC] Comparable
| From: | Rowan Collins | Date: | Wed, 01 Feb 2017 13:44:25 +0000 |
| Subject: | Re: [RFC] Comparable | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98107@lists.php.net to get a copy of this message | ||
On 31 January 2017 23:02:07 GMT+00:00, Ryan Pallas <derokorian@gmail.com> wrote:
>I would say compareTo makes sense, because that's what you're asking
>the
>method to do. Methods aren't usually past tense as it would seem weird.
To be specific, methods are generally named as "imperative" phrases, because they are
instructing the object in question to do something. Read the "->" as "I would like
you to", and you get "$foo, I would like you to compareTo $bar".
The only real exception I can think of is boolean tests like "isFoo" and
"hasFoo", which are hard to put succinctly in imperative form (Ruby instead uses the
convention of "foo?"). "withFoo" is also common, as shorthand for
"getCloneWithFoo" - but note it doesn't have a verb at all.
Regards,
--
Rowan Collins
[IMSoP]