Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129514 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 213141A00BC for ; Tue, 2 Dec 2025 20:06:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764706004; bh=zsBl7DZmTIJ6S7cjmkSUUwFAhr2ybfaVS7Y47mymA54=; h=Date:From:To:In-Reply-To:References:Subject:From; b=nezXfngVe2D94bRc+YY3bx/sYAID6qKmDxny6XZRnOHmGt7hvuO5mCRrwqQWwO8Dh /+G3D6XtJhCZPbPPuCmkRbvL06YniawoCMQYfDkMy6KzLnd8eWZ5hxgdykUGU4Q/F/ Ze9XNP6WKeAHa4/1rFXUEw3l5qhHTvXh5R0liQaGGied7K8m8vDm7nZkYkclmvsnHU 1Zju4tZ0m2oZl93p8LnDjhW5K+q+Sf7wK4zI4eTafKy7H8pODE6x7RFoldkejJ+iBs VA6OJOqj2LHxloZjCw56j4rbSJfHKwWMcrTCnstV+cCpAYeK/zIofJDgDhttlToM2W +Q1YQn7WNgu/A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3B9BD1804C7 for ; Tue, 2 Dec 2025 20:06:43 +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-a5-smtp.messagingengine.com (fhigh-a5-smtp.messagingengine.com [103.168.172.156]) (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 ; Tue, 2 Dec 2025 20:06:41 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 2CDAD140010D for ; Tue, 2 Dec 2025 15:06:36 -0500 (EST) Received: from phl-imap-01 ([10.202.2.91]) by phl-compute-04.internal (MEProxy); Tue, 02 Dec 2025 15:06:36 -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=1764705996; x=1764792396; bh=RKar0NsjS1MmXwmoFZBwA oQMxatRX3yKgFrwF8heyIo=; b=mS3+WxAHTwGOuoQS2WeZ6vfFfgqZRjIRgohz8 S7b5aMwBk7E8tdvRCgpl+OEGgfX+f98wOHTEYa9653B6n3AFAgcK8A4Gs8Q8XI7E sSOqZphS5AdiNcPBEpQouqFQQiMnftfZ5Zm0vwIuu9YpS3tS7jolLGHzmkNLeCZt oDefzIL53xUh5GbUuV+gkKTKAHfOFTHENyAKeQK3Ki2N2X1aik2fEDRCD3SRbYEJ TJK3la1zYfoxI7fFDsHLpnWI0j0UylMlUoCXxas+tVVdcPLESbXe9pWhxyuXbB2j HG3cq1RtFt0g8OacROaUcM4Apb+5foNYlH0LY3a2Mgm0qlbdQ== 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=1764705996; x=1764792396; bh=R Kar0NsjS1MmXwmoFZBwAoQMxatRX3yKgFrwF8heyIo=; b=Ist1kvNYIV9xmtJCu BYI8IiToN5+AVg7SMZgSuFhrg8hqviTpsO6oh6VlLSiXjB7crIfXyhr8mgttWz20 NGa5s2syvSodtiw5E2gbftsk7nbzK3nNCMHrzSk6/2Y6eSn5iBCW2De2uzbTng/C 2VltzkY0eQloGvEU6pP1STi9kVQelGF5v0yp7u4jetnQ9wm0B0WAEAnwqR7dzg2/ SE3GQXIbC4l6RA40P7ZDTGseUkEJZtFCc2/gLmFo+gP0Ho3rxRco+QNZOk3FQTxx God1uHJeQXG3ws41it0lapTy7IIsEmAcCSTLxdqg8DsLCpDIA6kimm7fJqJE7FWu 7sAMA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddutdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh epofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhihucfi rghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqeenuc ggtffrrghtthgvrhhnpeeugfetieejueevffdulefhhfethfekvedtueevgfffvdefiedv tefgheevteelffenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlught vggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id CACB618C004E; Tue, 2 Dec 2025 15:06:35 -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: Tue, 02 Dec 2025 14:06:15 -0600 To: "php internals" Message-ID: In-Reply-To: References: 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 6:28 AM, Alexandru P=C4=83tr=C4=83nescu wrote: > On Mon, Dec 1, 2025 at 11:39=E2=80=AFPM Larry Garfield wrote: >> Hi folks. Ilija and I would like to present our latest RFC endeavor,= pattern matching: >>=20 >> https://wiki.php.net/rfc/pattern-matching >>=20 > > Great work, very detailed and well written. Thanks! > 1. There are mentions that any type present in a function parameter=20 > signature and return value is a valid pattern matching. > But are there any plans to extend the pattern-matching-syntax to=20 > parameter types and return values? > > Of course, with some restrictions: without variable pinning.And withou= t=20 > variable binding on return type, but that could work on parameter type= s. > If that's possible or already planned, I think it's worth mentioning i= t=20 > in the future scope section. See the linked "speculative extensions" document. It's mentioned there,= but it hasn't gone beyond "Larry thinks it would be kinda cool to write= `public int $x is >0`. That's definitely out of scope for now, but I'm= very open to discussing it in the future. > 2. Maybe some parts of the RFC could be separated to reduce complexity. > Thinking about variable pinning. Actually, with the new implementation variable pinning turned out to be = stupidly easy. That was a convenient bonus, which is why we included it= in the initial RFC. It was originally in future scope, but the diff to= add it was like 10 lines or something, so we included it now. The futu= re-scopes that are still in future-scope are all "harder than they look"= or "deciding what exactly to do will be a lot of discussion", which is = why they're there and not in the base release. > 3. For match() "is" placement, I would go with the second form as it's=20 > more flexible, but I think allowing both forms might be nice if the=20 > complexity is not too high. > Or go only with the second form now, and add the first form later in a=20 > smaller RFC. Noted! I think that's one vote for a single is, and one vote for a sepa= rate one for each arm. :-) --Larry Garfield