Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88625 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59323 invoked from network); 1 Oct 2015 20:49:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Oct 2015 20:49:30 -0000 X-Host-Fingerprint: 2.218.138.102 unknown Received: from [2.218.138.102] ([2.218.138.102:29568] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B3/16-26330-85C9D065 for ; Thu, 01 Oct 2015 16:49:30 -0400 Message-ID: To: internals@lists.php.net References: X-Mozilla-News-Host: news://news.php.net Date: Thu, 1 Oct 2015 21:49:26 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0 SeaMonkey/2.35 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 2.218.138.102 Subject: Re: new foo()->bar() syntax error : "new" associativity From: ajf@ajf.me (Andrea Faulds) 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/