Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129503 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 AE1431ADC92 for ; Tue, 2 Dec 2025 06:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764658364; bh=PL0iH1eHxVrWX3JB4xXUs9tB6fvFm6G+rKc75Fxr2DA=; h=Date:From:To:In-Reply-To:References:Subject:From; b=S3XVcfTdRQnJ6/A+prXwKVIblT9Rg2RKPTXZ4BU6kUv3T1OZhBbIYoJcK8+SQoATO r0Ko6qJ4tmFhXBxDE+WF5BYjXE855Tra8C2wZhunUxsApa6C6ZyYfmfAzFZOcXoNW/ zl++9pqH77LHG4ROzMcONuccBcuBUhbvxw46pp0zMa9dvZmTyErBfxdLICQ2v4BpS8 Q6tZH6X22MT8MUtnXuG3Eh54Xr9UaCagZoNDkF/EhXlJIcLXwMbDKs2G/eQH+WQB4c 3PuXcEMBotfG0ejjJ4hQq7zMr4S0CSikwUe6+C/C3tBt1CjdVvBI6tbR1rXll3jZSU 2ukAwU9gYrzYw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1A0CC1801EA for ; Tue, 2 Dec 2025 06:52:42 +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,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-a4-smtp.messagingengine.com (fout-a4-smtp.messagingengine.com [103.168.172.147]) (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 ; Tue, 2 Dec 2025 06:52:39 +0000 (UTC) Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfout.phl.internal (Postfix) with ESMTP id 9DA26EC0218 for ; Tue, 2 Dec 2025 01:52:34 -0500 (EST) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-12.internal (MEProxy); Tue, 02 Dec 2025 01:52:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc: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=1764658354; x=1764744754; bh=vSeTD24mDq NveAHdVckaarlpAguXmmJug7EOXReC6/s=; b=p3gzcK10ybgSRQ3OlqVzc2XgTg sezf5nxacI2AbZCIg/hJsgso8ssDZwREaBo0MWhnlgSiqGnGh1rCabQZ9/4bYwLJ VKAXuN3mxdJhIKeQVZREtl5QYXBh59IV/zDSvh5a7aNDXHnEL7zHmHtwOC42PcLR bmZMeEJZRUVsb4H76WpgXUTtg6bJbD+rIPp0e6s7Lvf2qsCFW+TPbdUsNQk9lQZD Yf9RGHLrbOdkwhaGBefKHJzBjkKDKCtSKrhRrqLtsFkOOO25JzpkvvnCKbmlYzpZ vLuIEVGfzym8A+2Zslc9m1wXQ75ypkKfIc2PETdykjU0/fMqj23O4uv2w2KA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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= 1764658354; x=1764744754; bh=vSeTD24mDqNveAHdVckaarlpAguXmmJug7E OXReC6/s=; b=tPEAACccXGiv1VXxUJng8Wxdu7zkC+c92mK6V/t/kh7wrB+WXNk YOHfIaePP8zk2cuq/l4KbY58aZwBNA9KgEXR6ehZWNcO+zzbx891wpZaXkAN1Lm1 dt/H7ubaT3h/HUdX31B96oSkAWuOHtXOS6RXff/lMbjj1v95gN+/Swyo38ypj7zL 24UwNSDCX6yZv+i9KD/6hK5sq90rYVyn2H36j6yLoInHI33wkk1EWBzs3ij66TlI VOJaS9ci1a7P1b/Ohk0tRX/93JQr231j+LCvpZowC8pOENU51VcEAw446Qf+o1cD ciAr/W9Xzte5/xIdoZ13le6xoNgXEvyjLXA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvheelledtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvkfgjfhfutgesrgdtreerre dtjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgssegsohhtthhlvggu rdgtohguvghsqeenucggtffrrghtthgvrhhnpeelkeehtdfgfefhleeilefggeeihfekvd elfeejtdfflefhheehfffgudetuddutdenucffohhmrghinhepphhhphdrnhgvthenucev lhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgssegsoh htthhlvggurdgtohguvghspdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 50DFA1820054; Tue, 2 Dec 2025 01:52:34 -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: AAoQuPDe3_77 Date: Tue, 02 Dec 2025 07:52:14 +0100 To: internals@lists.php.net Message-ID: In-Reply-To: <9af704c9-00f0-4916-82e2-0b3cafbc390f@app.fastmail.com> References: <9af704c9-00f0-4916-82e2-0b3cafbc390f@app.fastmail.com> Subject: Re: [PHP-DEV] [RFC] Pattern Matching Content-Type: multipart/alternative; boundary=48a3975bf73f44f6979ee93fceeb3b53 From: rob@bottled.codes ("Rob Landers") --48a3975bf73f44f6979ee93fceeb3b53 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Dec 2, 2025, at 07:51, Rob Landers wrote: > On Mon, Dec 1, 2025, at 22:36, 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 >> You may note the date on the RFC is from 2020. Yes, we really have h= ad this one in-progress for 5 years. :-) (Though it was inactive for ma= ny of those years, in fairness.) Pattern matching was intended as the n= ext follow up to Enums, as it's a stepping stone toward full ADT support= . However, we also feel it has enormous benefit on its own for simplify= ing complex comparisons. >>=20 >> This RFC has been through numerous iterations, including a full imple= mentation rewrite just recently that made a number of features much easi= er. We have therefore included two patterns that were previously slated= for later inclusion but turned out to be trivially easy in the new appr= oach. (Variable pinning and numeric comparison.) >>=20 >> Nonetheless, there are two outstanding questions on which we are look= ing for feedback. >>=20 >> Naturally given the timing, we will not be calling a vote until at le= ast late January, regardless of how the discussion goes. So, plenty of = time to express your support. :-) >>=20 >> --=20 >> Larry Garfield >> larry@garfieldtech.com >=20 > One thing I didn't see covered: accessing static variables in a class: >=20 > class Point { > public static $origin =3D new Point(0,0,0); > } >=20 > How do we pattern match to this? Is it the obvious Point::$origin? Sam= e with class constants? >=20 > =E2=80=94 Rob I literally saw it just after sending the email and missed the "undo sen= d" by milliseconds. Sorry for the noise. =E2=80=94 Rob --48a3975bf73f44f6979ee93fceeb3b53 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Tue, Dec 2, 2025, at 07:51, Rob Landers wrote:
On Mon, Dec 1, 2025= , at 22:36, Larry Garfield wrote:
Hi folks.  Ilija and I would like to present = our latest RFC endeavor, pattern matching:


You may note the date o= n the RFC is from 2020.  Yes, we really have had this one in-progre= ss for 5 years. :-)  (Though it was inactive for many of those year= s, in fairness.)  Pattern matching was intended as the next follow = up to Enums, as it's a stepping stone toward full ADT support.  How= ever, we also feel it has enormous benefit on its own for simplifying co= mplex comparisons.

This RFC has been through nu= merous iterations, including a full implementation rewrite just recently= that made a number of features much easier.  We have therefore inc= luded two patterns that were previously slated for later inclusion but t= urned out to be trivially easy in the new approach.  (Variable pinn= ing and numeric comparison.)

Nonetheless, there= are two outstanding questions on which we are looking for feedback.

Naturally given the timing, we will not be calling= a vote until at least late January, regardless of how the discussion go= es.  So, plenty of time to express your support. :-)

=
-- 
  Larry Garfield

One thing I didn't see covered: acc= essing static variables in a class:

class Point= {
  public static $origin =3D new Point(0,0,0);
}

How do we pattern match to this? Is it the = obvious Point::$origin? Same with class constants?

<= div id=3D"qt-sig121229152">=E2=80=94 Rob

I literally saw it just after sending the email and missed the "u= ndo send" by milliseconds. Sorry for the noise.

=E2=80=94 Rob
--48a3975bf73f44f6979ee93fceeb3b53--