On Sat, 24 Aug 2024, 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.
I liked this up to the point where I saw:
$f = fn ($v = 1, $default = 2) => $v + $default;
var_dump($f(default: default + 1)); // int(4)
Using 'default' as a place holder for (not) passing an argument seems
useful. I am however much uncertain about using composition with the
keyword in expressions.
I also think that implementation would probably be significantly less
complex as it was only used for placeholders. It's likely something that
can be handled in the parser.
Having an opcode for it, that does internal reflection, is what I'm
unsure about.
cheers,
Derick