> Le 26 juin 2019 à 08:50, Christian Schneider <cschn...@cschneid.com> a écrit :
>
> Am 25.06.2019 um 15:09 schrieb Arnold Daniels <arnold.adaniels...@gmail.com>:
>> 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
>
> While I understand that some people don't like the way PHP does type
> conversions I think this proposal creates a much bigger element of surprise
> when copying PHP code from one place to another than all the .ini-settings
> ever did.
>
> It basically creates two languages in one and I won't be able to determine
> what
> $a == 42
> exactly does without having to look at the header of the file.
>
> I'm inclined to say that if you want to make PHP a new language with a new
> core type concept then you should fork it and call it something else to avoid
> confusion.
>
> - Chris
>
Indeed. The directive may make operators more strict in what they accept, but
it should avoid changing the semantics. Concretely, we must have either:
"120" > "99.9"; // true
or:
"120" > "99.9"; // TypeError
Anything else will bring confusion.
—Claude
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php