Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120116 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 81430 invoked from network); 24 Apr 2023 00:58:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 24 Apr 2023 00:58:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4C344180505 for ; Sun, 23 Apr 2023 17:58:27 -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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS19151 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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 23 Apr 2023 17:58:26 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 3271D5C0036 for ; Sun, 23 Apr 2023 20:58:25 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute4.internal (MEProxy); Sun, 23 Apr 2023 20:58:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1682297905; x=1682384305; bh=M1tJWG4qO/ 3emb6Gbrbm1YMUl6omPz+EkbW1rBu0A80=; b=U04hHHryAvYaFgcO+sYDqlpfm7 kGVxycJanMHNnw0ILFAqT0hSD1oRCsTCYVKL4IuuBCdEwJT3bqvFZ+Y7tSdVc+BC qbwafUI6MSq8VawEQ8YoBF5hCSmOwNS+GYwQ3mG06z8PfMlsX5CoY5gYp4fSj6Kd 8PWmleCi1YQsmTaFg3/yGknb8Y31sxUP/eBrnh07TytzbPjwkckXcljxoYxkCAxS fvgvSp50EIYfKa95QAJbU1RsZYjosGn6PW9ihQTiSKiptjpbIa8XXq7V8wieYCGq AbStHwQdkWHJ1grzSjTuRdFOsA+OnYJ/IuB/IBprRvuOL7pPWH/b0u2LF10w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1682297905; x= 1682384305; bh=M1tJWG4qO/3emb6Gbrbm1YMUl6omPz+EkbW1rBu0A80=; b=B tIPv1Gr8mds+2WTRrLJVMTuPHup2L3ZDSmFus+d5Z7zLfE8AaXdVnE6P9ABWEzq1 qQLb3a9kjsdt1Xuh4ggtWXZnrCs+Bd0zpiZnwhSm4bn97KuNR4h9+EPoBDGgWoVx 65C9WfTiCdGQteKIARHqQbHRKpd4koa8DvKzF3IuYFBVo7ds/zZ2U+S8APEH0L4C hi85fZS5WnrKbzbEN8pnbgGMf5HvLCfA9ydD79gGFr6nE6XMeCl6JrkziPzVqlf0 k+YrAK9tgTgrQVdirxw7kFt9YObgyhuo0qMg30bCQxwtiCeoalsodEYNf9oD7mMS x1UL1Ae7jBlHx34u25+Gw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfedtledggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepjeeiieeivdevudetheeufeekvdeftdejffdvledt keelhedtffdttdelffduveejnecuffhomhgrihhnpegtvddrtghomhdpmhhitghrohhsoh hfthdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhr ohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomh X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id CB8941700089; Sun, 23 Apr 2023 20:58:24 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-372-g43825cb665-fm-20230411.003-g43825cb6 Mime-Version: 1.0 Message-ID: In-Reply-To: References: Date: Sun, 23 Apr 2023 19:58:04 -0500 To: "php internals" Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] [Discussion] Clone with From: larry@garfieldtech.com ("Larry Garfield") On Sun, Apr 23, 2023, at 6:01 PM, M=C3=A1t=C3=A9 Kocsis wrote: > What about argument unpacking? >> I don't know if we can combine this with ":" syntax or only with "=3D= >". > > > For now, argument unpacking (property unpacking?) is not possible. But= it > is definitely something that could be added in the future. Not currently written but could be, or there's some reason why that is p= articularly hard? > Tim wrote: > > I'd rather see only the fat-arrow being allowed. Unless I'm missing >> something, braces with colon is not used anywhere else, whereas brace= s + >> '=3D>' is known from match() and '=3D>' more generally is already use= d with >> array literals [1]. Having two similar syntaxes for the same thing is >> not great when both are commonly needed is not great. They need to be >> documented and learned by developers. > > > I can only repeat what Rowan answered, since I agree with it completel= y: > > I think it makes sense to have an unquoted form here, because the comm= on >> case is that they are names which analysers can match statically to >> particular properties, not strings which will be analysed at runtime.= There >> are plenty of places in the language where dynamic names are allowed,= but >> we don't just use strings for the static case > > > However, I'm not completely sold on making "clone with" look like a > function call (return clone $this with (a: 1);), but > at least I like it more than using an array-like style (return clone=20 > $this > with [a: 1];). My intention with > using curly brackets (return clone $this with {a: 1};) is to highlight=20 > the > fact that it is a map > of key-value pairs, similarly how the JSON standard does so. Not to=20 > mention > that "clone with" serves a very > similar purpose to object initializers, and the different languages I=20 > know > to have this feature use > a similar syntax (Java: http://wiki.c2.com/?DoubleBraceInitialization,=20 > C#: > https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/clas= ses-and-structs/object-and-collection-initializers#object-initializers > ). > > Regards, > M=C3=A1t=C3=A9 True, but PHP 8.0 sort of added something close to object initializers w= ith the combination of constructor promotion and named arguments. It's = not exactly the same thing, but it's the effective equivalent in PHP tod= ay. So if you want to model on object initializers, named args would be= the closest PHP equivalent. --Larry Garfield