Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:107181 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 57441 invoked from network); 17 Sep 2019 00:18:54 -0000 Received: from unknown (HELO php-smtp3.php.net) (208.43.231.12) by pb1.pair.com with SMTP; 17 Sep 2019 00:18:54 -0000 Received: from php-smtp3.php.net (localhost [127.0.0.1]) by php-smtp3.php.net (Postfix) with ESMTP id 39EAB2C2E08 for ; Mon, 16 Sep 2019 14:55:52 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp3.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,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 64.147.123.0/24 X-Spam-Virus: No Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp3.php.net (Postfix) with ESMTPS for ; Mon, 16 Sep 2019 14:55:51 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 60EDF753 for ; Mon, 16 Sep 2019 17:55:50 -0400 (EDT) Received: from imap26 ([10.202.2.76]) by compute7.internal (MEProxy); Mon, 16 Sep 2019 17:55:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding: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=4R1PYc8kUe0z1Caad3aURYNJWDYTylzWYDOsCQE4h +Y=; b=NRuGwonlp2recPkkEsEnNqWYvPTF42arKRhw6No/bA+StnCZqUy7IY/fv G3/JfGwhCZL/E01SCX9NNR8aEHxLHqAXh4TzkrNA1n/Vb0ixGOu1HjgVnkcB7zFt 3DZD7yJyMJnDt98kQLCc9+0wA8LC3mLjiBXEEftlls+9Bb5m4czUKnqD94eibIf2 +APmWYIDnG2E66nbJQG91tpnS1MbHyrTlqQBiKEkmX1+0FZ92QNF9JJFcXDNutNx Yyrnk0qEKnVIhD+5HAGdOuvUJdzk3alUV9AG2ReMJ22GzL5JZxesMS3QCTkPvzjp ejrPmty905PA9f5mvCc8VgX9hBCBQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudeggddtgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgfgsehtqh ertderreejnecuhfhrohhmpedfnfgrrhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhih sehgrghrfhhivghlughtvggthhdrtghomheqnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhenucevlhhushhtvghrufhiiigv pedt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id B03AE14200A1; Mon, 16 Sep 2019 17:55:49 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-237-gf35468d-fmstable-20190912v1 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Mon, 16 Sep 2019 16:55:29 -0500 To: internals@lists.php.net Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Envelope-From: Subject: Re: [PHP-DEV] Re: [RFC] Object Initializer From: larry@garfieldtech.com ("Larry Garfield") On Mon, Sep 16, 2019, at 10:16 AM, Micha=C5=82 Brzuchalski wrote: > Hi Rowan, >=20 > pon., 16 wrz 2019 o 16:57 Rowan Tommins > napisa=C5=82(a): >=20 > > > > > >> > >>> > >>> That would require multiple new features, though, so initializers = might > >>> be > >>> more achievable in the short term, and perhaps there is room for b= oth, > >>> particularly if support for getters and setters improves. > >>> > >>> > >> Here again, IIRC you're trying to solve the issue which is off-topi= c. > >> Improving protected and private properties initialization through > >> constructor is not the main target of current RFC. > >> > > > > > > > > I don't think it's off-topic to consider whether a related feature w= ould > > make this one redundant. However, you've picked a weird sentence to = reply > > to, because I'm agreeing with you, that the two features could exist= side > > by side without being redundant. > > >=20 > Sorry for that, the quoted sentence was left unintentionally and yes, = it's > not off-topic. > Had to rethink what I was trying to say, but I do think both these fea= tures > could exist. >=20 > Regards, > Micha=C5=82 Brzuchalski I am not sure I agree here. As I noted earlier, we're running out of si= gils. Suppose initializer syntax used: new Employee{prop =3D "val"}; Now later we want to add named parameters. What happens if we use the s= ame syntax? Does it mean the same thing, really? Or does the meaning o= f that call syntax vary depending on whether the constructor is defined = in such a way to make it support named parameters? What happens when it= could mean either, but the result would be different? Or do we have to= guarantee that the result is the same, even if that means limiting one = or the other? That could be avoided by using some other syntax for named parameter cal= ls, say: new Employee({ prop =3D "val"}); But now we have two syntaxes that do *almost* the same thing, but with s= ubtle differences, and the existing positional syntax, which means there= 's now 3 ways to create an object that look very similar visually but me= an slightly different things. That's... not good. I still hold that initializers as described, even though I like the prob= lem they're solving being solved, are a strict subset of the combination= of named parameters and auto-constructor promotion. If we had those, w= e would have more functionality and initializer functionality comes for = free, and it would be more self-evident what was going on, with fewer sy= ntax variations. Whereas adding initializers now as a one-off would lik= ely make adding those later more difficult. Thus I would rather see time spent on adding those than on a one-off syn= tax. (And yes, I fully realize I am saying that as someone not currentl= y working on any of the above syntaxes and so I'm talking about other pe= ople doing work, etc.) --Larry Garfield