On Tue, Apr 23, 2024 at 3:31 PM Robert Landers <landers.rob...@gmail.com>
wrote:

> On Tue, Apr 23, 2024 at 11:10 AM Valentin Udaltsov
> <udaltsov.valen...@gmail.com> wrote:
> >
> >
> > Does anyone have additional feedback? I'd like to start voting on
> Thursday, April 25th.
> > I've also added a section on other syntax ideas that have been expressed
> on Twitter and in the PR:
> https://wiki.php.net/rfc/new_without_parentheses#other_syntax_ideas
> > --
> > Valentin
>
> I suspect this will break (badly written) reflection in interesting ways:
>
> https://3v4l.org/mcSNH
>
> This basically breaks dereferencing order of operations and makes it
> inconsistent.
>

Quote from RFC:
"RFC still does not allow to omit parentheses around the new expression
*without* constructor arguments' parentheses, because in some cases this
leads to an ambiguity"

And actually it mentions a list in the RFC:

// Instantiate and then access the instance or instantiate the result
of the expression?new MyClass::CONSTANT
<http://www.php.net/constant>;new MyClass::$staticProperty;new
$myClass::CONSTANT <http://www.php.net/constant>;new
$myClass::$staticProperty;new $myClass->property;new
$myClass->method();

But actually from all of those, right now, only "new MyClass::CONSTANT
<http://www.php.net/constant>;" and "*new* $myClass::CONSTANT
<http://www.php.net/constant>;" are not working, while the other 4 are
working fine.

So yeah, this needs clarification if they continue to work as they work
right now:
https://3v4l.org/PmCfR

Thanks,
Alex

Reply via email to