Re: [RFC][DISCUSSION] Strict operators directive

From: Date: Mon, 06 Jul 2020 16:33:33 +0000
Subject: Re: [RFC][DISCUSSION] Strict operators directive
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-110850@lists.php.net to get a copy of this message
On Mon, Jul 6, 2020 at 5:27 PM Arnold Daniels <arnold.adaniels.nl@gmail.com> wrote: > Hi all, > > I'd like to start the discussion of the "Strict operators directive" RFC > version 1.5. This RFC proposes a new directive strict_operators, which > limits the type juggling done by operators to avoid unexpected results. > > https://wiki.php.net/rfc/strict_operators > > There are some significant changes from the previous version. > strict_operators no longer has cases where it changes the outcome of an > operation. To achieve this the following changes are made to the RFC > > * All comparison operators, besides === and > !==, only accept int and > float operands. For any other type a > TypeError is thrown. This includes > == and !=. > what about DateTime and other objects overwriting comparison operators? (GMP, ...) How would this proposal affect future proposals that expose comparisons to userland (see for example the operator overloading RFC). * The switch statement is not affected. > > For frequently asked questions please see > https://wiki.php.net/rfc/strict_operators/faq. > Honestly PHP comparisons are already complex enough, introducing a second set of rules that are just as complex seems like a risky proposal to me. > > [Arnold Daniels - Chat @ Spike]( > > https://spikenow.com/r/a/?ref=spike-organic-signature&_ts=l1bam) > [l1bam]

« previous php.internals (#110850) next »