Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129525 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 lists.php.net (Postfix) with ESMTPS id E930E1A00BC for ; Wed, 3 Dec 2025 15:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764777273; bh=O2/26sOMLgnzgL99kNZlGoyj7nH8dvOTTfMoJSkupz0=; h=Date:From:To:In-Reply-To:References:Subject:From; b=QwFqoe+N7FNtv9JtTJ06pJrn1lrBUd9zNkqqHcxZ7Rvc2XugE1V9b8OM7162+Wx81 f8LdNMoWYYlECcTETxWvx3w5U6GLbxmP2TLn3l3RmARLwAVT/PYqJuhtsxwOyjH+dG icXs1n8ZyPtOVw5L5kzVvtPVsS2DcSMq8GzRFo3KuhEPZyA/l7pjntLtFlYNP22dk+ pUJ2Q555uEw/TepGVtPoakcbukZGgT8uTaT545SAXFu+lS8Bf7IxzYk1B7NbkPhs3L BLRP0Ys5VrW92cWW7k/mgT3kjqMv4xU1jMo0iPK5lsm6YTHYkjqw8hLWK7u73OfqFu jXNCwUkJFv9qw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 17172180341 for ; Wed, 3 Dec 2025 15:54:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-b8-smtp.messagingengine.com (fout-b8-smtp.messagingengine.com [202.12.124.151]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 3 Dec 2025 15:54:30 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 096081D000D8 for ; Wed, 3 Dec 2025 10:54:25 -0500 (EST) Received: from phl-imap-01 ([10.202.2.91]) by phl-compute-04.internal (MEProxy); Wed, 03 Dec 2025 10:54:25 -0500 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:subject:subject:to :to; s=fm1; t=1764777264; x=1764863664; bh=y00rn6ZM5QPfT5FMeg5wf fPjl2A8OFOHvVT8Z6Ml2P8=; b=oUqdZoJsuGLham3VT0SZYh0GSFU+K3V+Pvd1+ GdvUPN+ikQh1ESnZ8mHG5QZKGikrTgLGXVq536gXgDP0MGRuCwJSaY+esB/dlywf HZO4I7c8VG7UMWV2SZWa5b1L+2lBTPje6bG9oIbqU3dew6IcftUFbluyE+k95p0W BeiS5MreeuJZ25gzU897yqbVKMR4mKscZyeoZPqZf4bLZnjYjgtjT/IUwoElL/yr NOj0zckXQBRHOZM6MpRv2jgN/zCWm+TUBbju+C+gJbzNRs8Ua8O+DnF1LduOuTxV mI2Zr0lqj0WudNkP3W6j1W9vgalGZTuWv5H7cvtJoy7cu4zMg== 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:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1764777264; x=1764863664; bh=y 00rn6ZM5QPfT5FMeg5wffPjl2A8OFOHvVT8Z6Ml2P8=; b=KtitZHQfI4GA6rKwM kZgWEOdIvu7C4XsTfZLhhrN8nCmbtsCG68rqnnZLm6hL2P2fSG8CQqjvlIuNfxep UdVqnvmOEBvfMJRWGF9jML5lTfmiFry1ET5v8FPHL9zRn5BHN5Jd94XG0qAqcyMU k8OLtwVxPFoomXUe+EiEe9Q3fUMiwIegRQAWugQX9Zos27W/OZDkf1Xhm5wbiz6B tI+v7SoS6M6cTqTSkwmJXOgo8I+tLJ0NwSeWCJGPR/uNmrowO1RFRUBR7+O31kLT NNedQjZEj6t9nblpenpPQQDRETgnIvcZJY2Kwh/qY8or4J9u8e5bO2yq/Guqn4Lk cO5FA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdefvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh epofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhihucfi rghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqeenuc ggtffrrghtthgvrhhnpeffieeivdfhvdeguddttdegteeiueegvefhteehfeeffeetudei tdehtdegjeeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslh hishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id B6EE518C004E; Wed, 3 Dec 2025 10:54:24 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: A0wUJIXp2QXJ Date: Wed, 03 Dec 2025 09:53:46 -0600 To: "php internals" Message-ID: In-Reply-To: References: <3b5b8394-fc68-48ff-abc9-c0e8f261fb46@app.fastmail.com> Subject: Re: [PHP-DEV] [RFC] Pattern Matching Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Tue, Dec 2, 2025, at 10:32 PM, Dmitry Derepko wrote: >> On Dec 3, 2025, at 12:03=E2=80=AFAM, Larry Garfield wrote: >>=20 >> $filtered =3D array_filter($arr, is Point(x: <10)); > > Btw, it looks incorrect and short closure is preferable here > array_filter($arr, fn($x) =3D> $x is Point()) As I said, that's not actually a syntax I'm proposing. Just spitballing= that it would be nice to be able to remove the `fn($x) =3D> $x` boilerp= late at some point. But that's not for this RFC; for now, the fact that= you can wrap a pattern up into a short closure is sufficient for reuse.= =20 > Or if it works with DFA > array_filter($arr, ? is Point()) > > If your example illustrated a pattern as an argument I think it=E2=80=99= s not=20 > valid case, because a pattern is something after =E2=80=9Cis=E2=80=9D?= The point,=20 > enumerated types or values. And =E2=80=9Cis=E2=80=9D here is an=20 > action/function/intention to match left and right operands.=20 > > But kotlin style is perfectly matched here > > array_filter($arr, { $it is Point() }) Ilija would agree with you, and has been arguing for a { $0 + 3 } type s= yntax for extra-short closures for a while now. :-) But that's not in s= cope for the moment. --Larry Garfield