Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110091 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 29257 invoked from network); 8 May 2020 20:08:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 8 May 2020 20:08:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 015A71804C2 for ; Fri, 8 May 2020 11:44:10 -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_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 8 May 2020 11:44:08 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 770FF5C015C for ; Fri, 8 May 2020 14:44:08 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Fri, 08 May 2020 14:44:08 -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=fm2; bh=ENsMP2 uC1za51vmxJUjISrPf67Sf3XWLYhfKNU11Oso=; b=Aup0d+hv2e/fnqT/EQ6Qfd W3whunB5sEzKz3YVW5dgxntM8EErSGPvCa/m9tFZeAMmAzPNmdfKjpz70tPaZU/V DEmWjnFt9IAItZdXB3l4S2XUJJTz9HBPIUF7sJEIanOD/qYBGiO410/RTDDLN6nc J2U94vkIj2uwikxoanVzH1IfvcteQRJ/E710/BaMHz/uP884f1oOo/DVRWAPDJq4 ZEeakEaV03CstEsHdTN4ujjMpEK7dqfb0RrSTMPGGFSN63WIxhSvsTaP4H9A4XZp oJialpHlTWvvsdpb4WGaM+YQjPizeVb/8niR+ZZdKwiFckAFYRiWJhYR6paUbwAA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrkeefgdeivdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtsehttdertderreejnecuhfhrohhmpedfnfgrrhhr hicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh eqnecuggftrfgrthhtvghrnheplefhjeduueegudeghfehudfgvdeflefffeeuteevuedt jeffkeetkeeiveejkefgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomheplhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id CFDCF14200A2; Fri, 8 May 2020 14:44:07 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-dev0-413-g750b809-fmstable-20200507v1 Mime-Version: 1.0 Message-ID: In-Reply-To: References: <1C09C0A9-1DA4-4753-8E5A-A739D52DA0B3@newclarity.net> <54c5f8f0-1526-53df-0912-0b00e0e54bc3@gmail.com> <44B0AB58-2993-403F-B75C-124AB26B6875@newclarity.net> Date: Fri, 08 May 2020 13:43:46 -0500 To: "php internals" Content-Type: text/plain Subject: =?UTF-8?Q?Re:_[PHP-DEV]_[RFC]_Parameter_Blocks_(vs._Constructor_Property?= =?UTF-8?Q?_Promotion_and_Named_Parameters)?= From: larry@garfieldtech.com ("Larry Garfield") On Fri, May 8, 2020, at 1:04 PM, Rowan Tommins wrote: > On 08/05/2020 02:32, Mike Schinkel wrote: > > 8. I believe this alternate syntax addresses Michal Bruzuchalski's and Larry Garfield's concerns... > > 10. Nikita claims there is a "line" to be crossed when property declarations have their own blocks and would disallow their use with CPP... > > > I hesitate to speak for them, but I think their concerns are more > conceptual: that this requires nesting a large portion of the class > definition inside the constructor definition. Changing the syntax > doesn't really change that - the "parameter block" would still be an > extra level of nesting, attached to the constructor definition, rather > than at the top level of the class, where it lives today. Correct. My concern isn't with comma vs semicolon. My concern is that the property definition is then living between `public function __construct(` and `) {`. When the property definition is basic (visibility, type, and something like readonly) that's still reasonable enough for the benefit it brings. When the property definition becomes involved enough that it is preferable to have it span lines (docblock, attributes, or something like property accessors or potentially even just asymmetric visibility), that's when I get fidgety, because then you're technically writing public function __construct(/** @see blah.html */ <> protected int $count, /** @see blah.html */ <> <> protected int $age,) { } Just with convenience newlines. Semi-colons and curly braces wouldn't in themselves address that. What *might* would be putting promotable properties in an entirely separate construct from the constructor. An off the cuff riff from that might be something like: class Stuff { promoted { /** * @see blah.html */ <> protected int $count; /** * @see blah.html */ <> <> protected int $age; } } That moves them out of the constructor entirely, and might overlap with the desire for named parameters. $p = new Stuff(5, 30); // or $p = new Stuff{count: 5, age: 30}; However, that has the major drawback of then not being in the constructor, so promoting only some constructor arguments becomes impossible. It's also worse on the BC front. I don't know if that's a good idea or not; as I said, just an off-the-cuff riff on what would address the "complex properties" question better. For the simple case, the current RFC syntax seems fine. (Maybe someone can riff off of this to something better.) --Larry Garfield