Re: [RFC] Combined Comparison (Spaceship) Operator
| From: | Andrea Faulds | Date: | Mon, 19 Jan 2015 14:13:47 +0000 |
| Subject: | Re: [RFC] Combined Comparison (Spaceship) Operator | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80823@lists.php.net to get a copy of this message | ||
Hi Alain,
> On 19 Jan 2015, at 12:53, Alain Williams <addw@phcomp.co.uk> wrote:
>
> On Mon, Jan 19, 2015 at 12:30:14PM +0000, Andrea Faulds wrote:
>>
>>
>>> On 19 Jan 2015, at 11:06, Alain Williams <addw@phcomp.co.uk> wrote:
>>>
>>> I like it.
>>>
>>> The RFC does not say what the precedence is to be. Could I suggest that it be
>>> the same as ''== != === !== <>'' - which keeps it consistent
>>> with Perl.
>>
>> It has the same precedence as the other comparison operators, it’s non-associative.
>
> Sorry to be a persistent pain, but PHP has 2 sets of comparison operators with
> different precedence:
>
> ''< <= > >=''
>
> ''== != === !== <>''
>
> I think that the RFC should clearly state that spaceship joins the 2nd set of
> operators in the precedence table. The introduction kind of hints that it would
> join the first lot -- but that would be inconsistent with Perl.
>
> http://uk1.php.net/manual/en/language.operators.precedence.php
Ah, I get you. I’m making it the same precedence as Perl (same as == and !=), then. I’ve updated
the RFC and will update the patch.
Thanks.
--
Andrea Faulds
http://ajf.me/