Re: Re: [RFC] Default expression

From: Date: Sun, 01 Sep 2024 16:45:57 +0000
Subject: Re: Re: [RFC] Default expression
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Sun, Sep 1, 2024, at 14:39, Rowan Tommins [IMSoP] wrote:
> On 29/08/2024 22:52, Bilge wrote:
> > On 24/08/2024 17:49, Bilge wrote:
> >>
> >> New RFC just dropped: https://wiki.php.net/rfc/default_expression.
> >> I 
> >> think some of you might enjoy this one. Hit me with any feedback.
> >>
> > Now the dust has settled, I've updated the RFC to version 1.1. The 
> > premise of the RFC is unchanged, but the proposal has been expanded 
> > and a discussion section added to summarise the ~100 message thread to 
> > capture the major concerns raised in a condensed format. I hope I've 
> > done a good job of fairly and accurately representing your concerns, 
> > but if not please correct me.
> 
> 
> As promised, I have written up a full explanation of the type safety 
> issues here: https://wiki.php.net/rfc/default_expression/type_safety
> 
> I have tried to write this as a neutral description of the problem and 
> the possible approaches we could take, to be inserted directly into the 
> current RFC, rather than as a counter-opinion or a narrative of who said 
> what.
> 
> I have included the 4 options which I believe are the only ones we have; 
> it is then a matter of opinion which we think is best. For the record, 
> my opinion remains that option 3 (limit to conditional expressions) is 
> preferable, but I have assumed the RFC will continue to advocate for 
> option 1 (allow any expression and assume problems will be rare).
> 
> I hope I have explained it clearly enough this time to overcome the 
> previous misunderstandings of where the issue lies.
> 
> Regards,
> 
> -- 
> Rowan Tommins
> [IMSoP]
> 

Thank you Rowan,

I wasn't following the discussion closely and didn't realize this was the issue. Thank you
for taking the time to describe it.

For option 1: 

Is manually copying the default also not type-safe? Is php a type-safe language? I think a lot of
the arguments I saw suggested that people don't review libraries and their implementations when
upgrading or installing them. This is just a shorthand for manually copy-pasting the default from
other code, and this argument really only makes sense to me if there are no reviews before
upgrading/using a library.

For option 3:

That being said, this is obviously playing with fire, and there will be people who (ab)use this and
get burned; especially if they don't do due-diligence before using libraries. Thus a
restriction may make a lot of sense; at least keeping it to the most obvious use cases should
prevent the worst case scenarios imagined in this thread.

Realistically, I think we should only consider option (1) or (3). Option (3) -- if it can be done --
is the more conservative approach, and we can observe how it is used. We can always relax the
feature in the future, based on feedback.

— Rob


Thread (101 messages)

« previous php.internals (#125376) next »