Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129920 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 395501A00BD for ; Sun, 25 Jan 2026 18:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769366699; bh=GpnzQLJyxElRpX2XJFma+oIH+pHFPuiLn+NgdRMLg5U=; h=Date:From:To:In-Reply-To:References:Subject:From; b=l73TEdymwoE8Ircx+ubte3sZ4z0j5uHTlvXjSYDxnAskezu6NzaBXJCGxiG9Az08u bvW9ObXLhcA0LS4Vet3zsEPgLdySsVQjsmxJTyYmeL/GhIZHjbzw6a5MvPrWV8q1c1 yJhb51SElOx7gndYiJLSa3lqQM4DLx8sJwb1l6SBjInXh17RcynTgMBwcfr/enHZeZ 68xd5msTI9eCDKU0ZrGedNMZnma+55askhFMvLmTm5/d8ZPXmfO3JzMQvZ8zcQrczx dqLTCXaZkUMH+Er3pOFH/6UITuDDiiJCMGsbHEzuN5byhuBZOOsdu1d3WasKQ51m4t YRhzirE98V8mQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2E75A180557 for ; Sun, 25 Jan 2026 18:44:58 +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.1 required=5.0 tests=BAYES_50,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 fhigh-b8-smtp.messagingengine.com (fhigh-b8-smtp.messagingengine.com [202.12.124.159]) (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 ; Sun, 25 Jan 2026 18:44:55 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.stl.internal (Postfix) with ESMTP id C23B67A00FF for ; Sun, 25 Jan 2026 13:44:50 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Sun, 25 Jan 2026 13:44:50 -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=fm2; t=1769366690; x=1769453090; bh=FdLSFQxeBM5Rzbh06ToWC KIoh5l2PRkADgAisaI6hFo=; b=t+iARcRjHGJvNRchoiJM0V1y9OPqv6t7hhQB1 8XXYzy4MxUXYbCqVZSwZvK1aZ1XLzxuBjA4hZ3cOZDQQHXsOP1x5nKSdrnIZSv26 3VfoYNtodCyUCPH9THIdKN33T7u9QWGA6IExhYewYQ3ofR30BfiBKycen5KruuA4 h7DMij5PsuL9exe+G4Ja6Q8YgS/LwZwx6Aic3lw95GfrpLVKI4LuGk4Fs9i6NXfH LGGaLIQV/9E4uSvg0okdELgRk+t7iinN0sd7lcbpW17+ETX4rQMeIYydCMGytNmN pQu+qAJnICIEFyDr6afmhVRGfGyQ4+crYRNw5NzfyURjWDvdA== 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=fm2; t=1769366690; x=1769453090; bh=F dLSFQxeBM5Rzbh06ToWCKIoh5l2PRkADgAisaI6hFo=; b=R3nOxMJRGXn9jsa+m Dt6N6nSPDL5JTOkvN5Gn1Apa5S+iWQxJV5+eTAp25R/TVjsOgMBmoSerjsn4zNFL VeFctzH+iM/cxqCakH3e3cft0ObWFsW8rd4Fd3tj/GBju0tdl3Hio3UCEvWzwfh9 cuVjamklY2AaE7aJu4RgdABKX4HRPoNYjoeyE8NGm/PFQtUsg3q0eFN1iH1O3hNJ 1H1fhhX1tizSxq7aTNO92tqwxEkAYXdCFiKzL3AUfJYR6nckaXBOJbvpajjYupGz aMXsrx05PWNda7W2i3Rhad0bDXZNyJB+U5jm7uCJM3EtTrMtbuS3g6XHT6eXryk2 /Fidw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduheehheegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeffieeivdfhvdeguddttdegteeiueegvefhteehfeeffeet udeitdehtdegjeeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspghrtghp thhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsh eslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 70A01700065; Sun, 25 Jan 2026 13:44:50 -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: Sun, 25 Jan 2026 12:44:29 -0600 To: "php internals" Message-ID: <23093833-bdd2-442d-86b8-9ef492c51ad1@app.fastmail.com> In-Reply-To: References: <56dce794-a512-421a-a8d2-91a9692c1ab4@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 Sat, Jan 24, 2026, at 12:25 PM, Tim D=C3=BCsterhus wrote: > Hi > > Am 2026-01-23 20:48, schrieb Larry Garfield: >> The idea of the second being that, if you want just an identity match= ,=20 >> you can skip adding `is` on just that one arm. > > I don't understand what that is trying to say. With a per-arm keyword, one could do this: $result =3D match ($somevar) { is Foo =3D> 'foo', // This matches against the pattern `Foo`, which = is a class name. Bar =3D> 'bar', // This matches =3D=3D=3D against the constant `= Bar`, whose value is whatever. }; The main reason we cannot just auto-detect whether it's a pattern is the= confusion between a class name and constant, since a constant is a lega= l literal value for an identity match. With per-arm, you can opt-in to = pattern matching individually, at the cost of having to remember to repe= at the keyword on every line. With per-block, you only have to add the = keyword once at the cost of not being able to selectively use patterns o= r identity matching. Which tradeoff is better is the option question. (Ilija and I disagree = on which to go with.) Or, if someone can suggest a way to allow automat= ic detection reliably, that would also be most welcome. :-) --Larry Garfield