> On May 15, 2020, at 17:03, Arnold Daniels <arnold.adaniels...@gmail.com> 
> wrote:
> 
> Hi all,
> 
> I'd like to restart the discussion for the strict_opterators RFC (
> https://wiki.php.net/rfc/strict_operators).


I’m having trouble wrapping my head around this statement:

> To compare two numeric strings as numbers, they need to be cast to
> integers or floats.

As an example, the RFC shows:

    "100" == "1e1";               // false
    (int)"100" == (int)"1e2";     // true

But this is identical to how PHP works today.

I think the identity operator is more expressive in this case,
especially to show intent.

> The function of the === and !== operators remains unchanged.

So, while `true != 0` throws a TypeError, `true !== 0` continues to
function as it does today, without a TypeError? I find this behavior
confusing and unintuitive.

I can see the value in what the RFC proposes (strict type comparisons),
but I think the behavior proposed still needs work. While I understand
it’s opt-in on a file-by-file basis, I don’t think changing the meaning
and behavior of existing operators is the right approach.

Maybe if we could introduce new comparison operator symbols? But I’m not
sure what those symbols would be.

Cheers,
Ben

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to