Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113404 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 83688 invoked from network); 6 Mar 2021 12:18:23 -0000 Received: from unknown (HELO localhost.localdomain) (76.75.200.58) by pb1.pair.com with SMTP; 6 Mar 2021 12:18:23 -0000 To: internals@lists.php.net References: Date: Sat, 6 Mar 2021 13:09:37 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 46.59.72.204 Subject: Re: [RFC] New in initializers From: ajf@ajf.me (Andrea Faulds) Message-ID: Hi Nikita, Nikita Popov wrote: > Hi internals, > > I would like to propose allowing the use of "new" inside various > initializer expressions: https://wiki.php.net/rfc/new_in_initializers > > In particular, this allows specifying object default values for properties > and parameters, and allows the use of objects as attribute arguments. > > The RFC is narrow in scope in that it only adds support for "new". An > extension to other call kinds should be straightforward though. > > Regards, > Nikita > This seems reasonable, but I fear it would create a similar mess to C++ with static initialisers, because a class constructor can do basically anything… I'm not sure what can be done about it, though. Thanks, Andrea