Re: [RFC] Default expression
| From: | Rob Landers | Date: | Sat, 24 Aug 2024 21:14:52 +0000 |
| Subject: | Re: [RFC] Default expression | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125194@lists.php.net to get a copy of this message | ||
On Sat, Aug 24, 2024, at 18:49, Bilge wrote:
> Hi gang,
>
> 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.
>
> This one already comes complete with working implementation that I've
> been cooking for a little while. Considering I don't know C or PHP
> internals, one might think implementing this feature would be
> prohibitively difficult, but considering the amount of help and guidance
> I received from Ilija, Bob and others, it would be truer to say it would
> have been more difficult to fail! Huge thanks to them.
>
> Cheers,
> Bilge
>
This is pretty awesome! I see this as some syntax sugar, to be honest:
> as soon as two or more nullable arguments are involved
I'm not sure what you mean here. I use this method all the time :) much to the chagrin of some
of my coworkers.
function stuff($foo = 'bar', $baz = 'world');
stuff(...[ ...($foo ? ['foo' => $foo] : []), ...($baz ? ['baz' => $baz] :
[])]);
Having this would be a lot less verbose.
— Rob