Re: new foo()->bar() syntax error : "new" associativity
| From: | Andrea Faulds | Date: | Thu, 01 Oct 2015 20:49:26 +0000 |
| Subject: | Re: new foo()->bar() syntax error : "new" associativity | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-88625@lists.php.net to get a copy of this message | ||
Hi Yasuo,
Yasuo Ohgaki wrote:
https://bugs.php.net/bug.php?id=70549 It seems this is better to be fixed in near future. Let "new" be associative? Currently, it's syntax error. Was there discussion for this with https://wiki.php.net/rfc/uniform_variable_syntax ?I think that we should keep
new working the way it does. While some other languages do make new Foo->bar be (new Foo)->bar, I don't think that's very intuitive. The whitespace between new and the class name has made me always read it as new (Foo->bar) instead. Continuing to require brackets here will mean people don't misinterpret it.
Also, as Nikita noted, there might be compatibility issues.
Thanks.
--
Andrea Faulds
http://ajf.me/