Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113382 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 82026 invoked from network); 4 Mar 2021 16:35:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Mar 2021 16:35:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DFE141804B8 for ; Thu, 4 Mar 2021 08:26:02 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_05,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 wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (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 ; Thu, 4 Mar 2021 08:26:02 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 2C25C12E7 for ; Thu, 4 Mar 2021 11:26:01 -0500 (EST) Received: from imap8 ([10.202.2.58]) by compute4.internal (MEProxy); Thu, 04 Mar 2021 11:26:01 -0500 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=fm2; bh=mZBnV7 dntdjbMjekAKF22DAekbHBmzskGrsLPFThk5A=; b=tzufnMFpZ1NSMtZ2g3//NL dZqTQkf0IYwvFWxIPZFyLKl34Ihl5jU6lIMHfrL+ACeWBECf1vCVTWrWoxkKDegk XauMTUeRLXcmmz5bkJuoN0V7jdbeaeew99+OjKdwFMUAnzMjUrW+deP+x5Bg52+D lLkvIsON2M6RMMDYgdesFJnb4smEqwe44CfkNMKk+XzNXA0PvIj4peWYlZ0TFcDY esfba/4YnHNSXJMlnjRfLpRjJFLHFXWMcMz2utaPuBbypJ/0o3naAhCmjI7z+E2D MZEwkfpV5V95Vju/6TCDLS1S5wkap83gp98fRP6pxbGAxpxAu4sJJDwcmrkZB99Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddtgedgkeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucggtffrrghtthgvrhhnpeeglefgkeduiedvvdetffeujefftdfhjeeiveehgfff keduveektddvledvvdfffeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 83D253A0285; Thu, 4 Mar 2021 11:26:00 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-206-g078a48fda5-fm-20210226.001-g078a48fd Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Thu, 04 Mar 2021 10:25:37 -0600 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] New in initializers From: larry@garfieldtech.com ("Larry Garfield") On Thu, Mar 4, 2021, at 7:53 AM, Nikita Popov wrote: > I've added a section that describes reflection methods. It works exactly as > you say. > > There is one interesting case though: How should > ReflectionObject::newInstanceWithoutConstructor() work? In the current > implementation, it will still evaluate the property defaults, including new > expressions. This makes sense to me, but I can also see an argument that > this method should not evaluate them -- however, in that case I believe it > should not initialize any properties at all (leave them in "uninitialized" > state). Populating property default values depending on what kind of > expression they contain seems like a no-go to me. > > @Ben Ramsey: Yes, it's possible to use nested new. Generally, all supported > constant expressions can be freely combined. > > Regards, > Nikita Would that then end up allowing enum cases to have an object backing value? enum Suit { case Hearts = new Heart; case Spades = new Spade; } Or is there something else that would prevent that? (I know Ilija ran into some complications there.) Overall, I think the benefit to attributes alone justifies this RFC. Endorse. --Larry Garfield