Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114891 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 1675 invoked from network); 15 Jun 2021 16:14:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Jun 2021 16:14:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1DA941804C0 for ; Tue, 15 Jun 2021 09:30:44 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 15 Jun 2021 09:30:43 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 7E3081691 for ; Tue, 15 Jun 2021 12:30:42 -0400 (EDT) Received: from imap8 ([10.202.2.58]) by compute3.internal (MEProxy); Tue, 15 Jun 2021 12:30:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=JABwwA b27yiJ+Jc8LH3DamVBi5buU60kQz992O3OQAg=; b=LQ0sX1AXfZgWRJdYTMEDFG AvKqS1BrfLXS1JUSxwwNpu6A44x/HXYJYkK850sgJlEcet0NBd4xWCn2jLNe4ROv 9WSAPugCIhGAIT0sTqXjYabnE1WZkTzZbN2iuafGflMqWPTza5WG7ZZjiTYgTBi/ Z2oRpq3ZvJA89usy2WKbz7+94iFTu+tPzDn4a4ddgrFimurjWY2JD494gea5IiYJ OhDJ0m9aEWUZibU419DzE07g8pkRfjLcSXGLionu28LI0kY7oOF0FS0K1kFziGR8 f8xOtF9F6hWXi17d2J7ISBXYipbaA4LLnzcmJsgJG3LpJalcg6/0ot2fwyasNQfA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedvjedguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepveehhedvveejledvvefgleevffdtjeekledvkeeg heffgfeivdejhffhledtudetnecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhf ihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id BA6CD3A095D; Tue, 15 Jun 2021 12:30:41 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-519-g27a961944e-fm-20210531.001-g27a96194 Mime-Version: 1.0 Message-ID: <33fd3541-8518-4f98-a258-705f85180ed1@www.fastmail.com> In-Reply-To: References: <88588b8f-5729-4458-90b1-c602f751e128@www.fastmail.com> Date: Tue, 15 Jun 2021 11:30:20 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] New in initializers From: larry@garfieldtech.com ("Larry Garfield") On Tue, Jun 15, 2021, at 10:06 AM, Nikita Popov wrote: > On Fri, Jun 11, 2021 at 5:02 PM Larry Garfield > wrote: > > > On Wed, Mar 3, 2021, at 9:03 AM, 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 > > > > Hi Nikita. What's the status of this RFC? Are you going to bring it to a > > vote, or is something else blocking it? > > > > I've just pushed a larger update to the RFC, which limits the places where > new is supported. > > Supported: > * Parameter default values (includes promoted properties) > * Attribute arguments > * Static variable initializers > * Global constant initializers > > Not supported: > * Static and non-static property initializers > * Class constant initializers > > I believe the cases that are now supported should be completely unambiguous > and uncontroversial. The other cases have evaluation order issues in one > way or another. This is discussed in > https://wiki.php.net/rfc/new_in_initializers#unsupported_positions. Thanks, Nikita. I would vote for this as is, but I am saddened by the lack of static property initializers. That's the main use case I am interested in. (In particular, because sealed classes plus new-in-static-property would allow for something substantially similar to tagged unions, just not built on enums, and the latter is not making it into 8.1 it looks like.) Arguments and attributes are enough to justify this RFC on its own, but is there a way we can resolve the static property question? Right now the RFC says "these initializers are evaluated lazily the first time a class is used in a certain way." Can you be more specific about that certain way? Is there a certain way that would be minimally disruptive? Also, I think there's a typo in the preceding paragraph about property initializers. It says "the disciplined invocation of such constructors from potential parent constructors." Shouldn't that be potential child constructors? --Larry Garfield