Hi

Am 2024-11-04 13:33, schrieb Rob Landers:
What would you expect the semantics of that script to be?

Isn't this semantically equivalent to:

Perhaps? That's the question I am asking. Given that this is not a valid PHP program as of now, it would as least be debatable how this is supposed to work. It gets funnier once you want to support variables in the general case (which I consider a necessary companion to support variable capturing):

    class Foo {
        public function __construct(&$out) {
            $out = 'out';
        }
    }

    function foo(
        string $bar,
        string $baz = new Foo($bar),
    ) {
        var_dump($bar, $baz);
    }

To be clear: We do not intend to solve this question with this RFC. These examples are just intended to highlight the (semantic) complexities of supporting variables within const-expr.

Best regards
Tim Düsterhus

Reply via email to