Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:123819
X-Original-To: internals@lists.php.net
Delivered-To: internals@lists.php.net
Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5])
	by qa.php.net (Postfix) with ESMTPS id 4D2941A009C
	for <internals@lists.php.net>; Tue, 25 Jun 2024 15:38:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1719329968; bh=zuPEf8gA+inlHE4N7OfIQdLIjlRPlat9rXRpqz/YNnw=;
	h=Date:From:To:cc:Subject:In-Reply-To:References:From;
	b=fBHIf4/Xp7PjPlpXrqQuHTA1h+0b8uczJbcOCni9Y9Il6WWT882xg03+FRehTI1lw
	 bCVp/+eQ56grl+s/qkkHRMebZIvyNtim6jFacbhRJy0TlwYc58lfAMnJyLIsubNPG9
	 50m6jQXRVcjLbgpTkfRSbEU4wIQF20h3lQAZXZKpfouIU0EoC84O8iWIcbTogopL5T
	 cUVb88O6eOSOjQKt0ge1p2NWXIpxzQ+bTeAsxAWt71biaUoJV4R8zp+GNHS1RFdoi1
	 2LIpmcIvkfp+gqKPWAAGQlSiWsB6kxrj970E6jM/gMvaRPjNx2saqt8/KnmpitCdec
	 BuUficLZpY40g==
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 463F618088F
	for <internals@lists.php.net>; Tue, 25 Jun 2024 15:39:28 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net
X-Spam-Level: ***
X-Spam-Status: No, score=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS,
	SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no
	version=4.0.0
X-Spam-Virus: Error (Cannot connect to unix socket
	'/var/run/clamav/clamd.ctl': connect: Connection refused)
X-Envelope-From: <derick@php.net>
Received: from xdebug.org (xdebug.org [82.113.146.227])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by php-smtp4.php.net (Postfix) with ESMTPS
	for <internals@lists.php.net>; Tue, 25 Jun 2024 15:39:27 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail;
	t=1719329888; bh=zuPEf8gA+inlHE4N7OfIQdLIjlRPlat9rXRpqz/YNnw=;
	h=Date:From:To:cc:Subject:In-Reply-To:References:From;
	b=ep3Dc9aG95DM7kJSLzxi0oWL6uCHeZ2n2sUIfdlLNmnhs2h8nz9GnYGOjrlbffVdP
	 1kmteQduQ3FdD+57YxJ/U5j3dr6g6IJptTNqW/YMS5Lt04+Ztr3/8q7MwB4DJRZL7Z
	 pSVZcHQwVeayyStE+fPUjiRQ+DtjxDVzI11zM+AzIauuYoiFlLdwC2Nl8M8KEegpg7
	 QUpcKS8kIpvgL4a6wJ25sj/94Y3CqGuyfp715UTTcqCO+fPxWKsaoz5gcnMi2XCVTC
	 Exl9Y5rhdUz76v71D8h1IGGFPTBVluB6v/VRS7sya8ocVnDO4HTbPOY7/C1DsmIa3F
	 NjArg3BnQTsnA==
Received: from localhost (localhost [IPv6:::1])
	by xdebug.org (Postfix) with ESMTPS id 744CB10C49D;
	Tue, 25 Jun 2024 16:38:08 +0100 (BST)
Date: Tue, 25 Jun 2024 16:38:08 +0100 (BST)
To: Larry Garfield <larry@garfieldtech.com>
cc: php internals <internals@lists.php.net>
Subject: Re: [PHP-DEV] [Early Feedback] Pattern matching
In-Reply-To: <d06e5a04-9601-4af4-bdad-4f5e92bc5e18@app.fastmail.com>
Message-ID: <c25a70a6-a251-59be-539e-4ce70b142033@php.net>
References: <2a6b92eb-d5e9-4a1a-9548-a068ac42ebd2@app.fastmail.com> <d06e5a04-9601-4af4-bdad-4f5e92bc5e18@app.fastmail.com>
Precedence: bulk
list-help: <mailto:internals+help@lists.php.net
list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net>
list-post: <mailto:internals@lists.php.net>
List-Id: internals.lists.php.net
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="8323329-2111162508-1719329888=:90438"
From: derick@php.net (Derick Rethans)

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323329-2111162508-1719329888=:90438
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: QUOTED-PRINTABLE

On Mon, 24 Jun 2024, Larry Garfield wrote:

> On Thu, Jun 20, 2024, at 5:38 PM, Larry Garfield wrote:
>=20
> * The placement of `is` on `match()` is still an open question.

"The latter is more explicit, and would allow individual arms to be=20
pattern matched or not depending on the presence of is."

Which would make it probably more useful, so I would be in favour of=20
having each arm have the "is".

> * No one has really weighed in on nested patterns for captured=20
> variables.  Any thoughts there?

In your example, you have:

if ($foo is Foo{a: @($someA), $b is Point(x: 5, y: @($someY)) }) {

And my brain can't parse that. I would have *no* idea what that means at=20
first sight.

In addition to just normal captured, variables:

"For object patterns (only), if the variable name to extract to is the=20
same as the name of the property, then the property name may be=20
omitted."

This is one I don't like. It adds another syntax, and IMO also makes=20
something less obvious what is happening. Too much magic=E2=84=A2.

So please:

=09if ($p is Point {z: $z, x: 3, y: $y} ) {

And not:

=09if ($p is Point {$z, x: 3, $y} ) {


cheers,
Derick
--8323329-2111162508-1719329888=:90438--