Re: [RFC] Strict operators directive

From: Date: Tue, 25 Jun 2019 20:27:03 +0000
Subject: Re: [RFC] Strict operators directive
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-106056@lists.php.net to get a copy of this message
On Tue, Jun 25, 2019 at 7:56 PM Guilliam Xavier <guilliam.xavier@gmail.com> wrote: > On Tue, Jun 25, 2019 at 3:09 PM Arnold Daniels > <arnold.adaniels.nl@gmail.com> wrote: > > > > Hi all, > > > > I would like to open the discussion for RFC: "Strict operators > directive". > > > > This RFC proposes a new directive 'strict_operators'. When enabled, > operators may cast operands to the expected type, but must comply to; > > > > * Typecasting is not based on the type of the other operand > > > > * Typecasting is not based on the value of any of the operands > > * Operators will throw a TypeError for unsupported types > > > > Reasoning; The current rules for type casting done by operators are > inconsistent and complex, which can lead to surprising results where a > statement seemingly contradicts itself. > > > > Using a directive means that backwards compatibility is guaranteed. > > > > https://wiki.php.net/rfc/strict_operators > > > > Yours, > > Arnold Daniels > > > > [Arnold Daniels - Chat @ Spike]( > > https://www.spikenow.com/?ref=spike-organic-signature&_ts=1mzl6) > [1mzl6] > > Hello, thanks for the impressive work... > I have just one interrogation: why disallow ~ for strings? > (e.g. currently ~"\x00\x01\x02" gives > "\xFF\xFE\xFD") > > -- > Guilliam Xavier > Using ~ for strings should be allowed. I fixed it in the RFC. Well spotted. - Arnold

« previous php.internals (#106056) next »