> Le 20 juin 2024 à 13:08, Vincent de Lau <vinc...@delau.nl> a écrit :
>
>
>
> From: Gina P. Banyard <intern...@gpb.moe>
> Sent: Wednesday, June 19, 2024 5:08 PM
>>
>> On Tuesday, 18 June 2024 at 17:37, Robert Landers
>> <landers.rob...@gmail.com> wrote:
>>
>>> Hello internals,
>>>
>>> [...]
>>>
>>> What are your thoughts?
>>
>> As self-proclaimed leading expert on PHP type juggling.
>> That it is a terrible idea with no gains whatsoever.
>> Renaming the declare statement does not improve the situation.
>>
>>> PS. Personally, I would rather unify non-strict and strict in some way
>>> that makes sense ... so, that route sounds nice too.
>>
>> See my old meta RFC: https://github.com/Girgias/unify-typing-modes-rfc
>>
>> It is a somewhat known hot take from mine that I think the strict_type
>> declare statement was a mistake. [1]
>> Mainly because it affects barely nothing in regard to the engine.
>>
>> I have written/co-authored multiple RFCs over the years to make the
>> default coercion mode less whack. [2][3][4][5][6][7]
>> And my container/offset RFC is in the same vein [8] which lead me into a
>> different rabbit hole then the one I was expecting to explore which is
>> addressing PHP's weird comparison semantics. [9]
>>
>> Therefore, I would rather we focus on *actually* fixing PHP's semantics,
>> than arguing about changing the name of something that shouldn't really
>> exist in the first place.
>
> Talking about 'going back in time' and sanitizing type coercion, I
> immediately had to think about the rejected 'Coercive Types for Function
> Arguments' RFC Zeev created as an alternative to the 'Scalar Type
> Declaration' RFC which was ultimately chosen and implemented.
>
> https://wiki.php.net/rfc/coercive_sth
>
> It seems that parts of what that RFC suggested have been implemented over
> time. In retrospect maybe this should have been the direction?
Hi,
The RFC you are pointing to was about introducing a new, more restrictive (and
saner) set of automatic coercion rules in the context of function arguments
*only*. For instance, `substr('xy', 1.2)` would have been deprecated, but `3 %
1.2` and `['x', 'y'][1.2]` would have continued to “work” (for some stretchy
definition of “work”).
What has been implemented over time, is making the existing set of automatic
coercion rules more restrictive (and saner) in *all* contexts. For instance,
all of `substr('xy', 1.2)`, `3 % 1.2` and `['x', 'y'][1.2]` are deprecated.
—Claude