Hey Bilge,
On 24.08.2024 18: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.
Great work overall, I'm all for it and even though it's not something I
saw myself using a whole lot, the json_encode example sold me on it
being more useful than I initially thought.
One question (sorry if someone already asked, I scanned the thread but
it is getting long..):
Taking this example from the RFC:
function g($p = null) {
f($p ?? default);
}
Could you go one step further and use default by default but still allow
null to be passed in?
function g($p = default) {
f($p);
}
I suppose this would mean $p has to hold this "default" value until a
function call is reached, at which point it would resolve to whatever
the default is. This probably complicates things for very little gain
but I had to ask.
Best,
Jordi