Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123805 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 7667D1A009C for ; Tue, 25 Jun 2024 07:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719300252; bh=6yFnalYylQPPJ22GJZJF9PARuMGHoH3Mh7cBlU+E1+A=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Fexl5ZVY+zCKVQNt7FmG2pv6y2mH7coxofJvdmULg0inXBHWa9dN+L3iA1E8kjqrY iZyEoVd0qOoRFxDHV7wxI5D8TP5snevQvNNybZnd+P1ZeMDVkorqXpu8eWKwndAFlF TelSxsT1brPAoVmte6BWi44PYLpmiE3VXOeqekUxU9T99LJt60GVjbDFMxY+E6WGqp oLqKUcECZiAkYdn5u2KKROZEWAxsdhAbu4DS4hqf6yiySIOgAMDq5gvWPF5YghpruF x7/c83q/EdAVtDB06CBE9f1HgHbGX44M66LeGNdoESshLJQhAWuYMQx9VAhF9lu4Zw UuQIs3pbKmOBg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 066D7180077 for ; Tue, 25 Jun 2024 07:24:12 +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=-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_PASS,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: Received: from fout6-smtp.messagingengine.com (fout6-smtp.messagingengine.com [103.168.172.149]) (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, 25 Jun 2024 07:24:11 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfout.nyi.internal (Postfix) with ESMTP id 4AC9B138025F for ; Tue, 25 Jun 2024 03:22:54 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 25 Jun 2024 03:22:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=1719300174; x=1719386574; bh=Ibzpm9Aik3fj3uXvULBQF4IHRZaL2fc2XTfdRXUb7Fo=; b= WkHlNvhPXzG/Vt7NdR8Afsq8ms/2oYxsaCMvX5kSEZ9UNXzd6LVKpbpOyTHiDZrl N6Iij6bn4LPO0gAMN1mJCB7Z8NwTXgdqPP/5dozaesqpmCcJljF5DGKAX1VUuN9t KNUikelVC1XY29UPMeJAkX8bnfdxdFuCyyG1TH67sOytxL+7ViPf/t1uqlLtekMy YPZVa8OP9WTyFAEW98Re9RVBEM7NLvgQPuFE5E9m0fwSOskmmIUgSwxS/r506HTW mSPryvoHOiWhhl9pSX629b9e8QTk6lMi+Tg6n2xrG+oV+2s7YNqewU1zhZTwpxIQ 0yKECNY0HkfORBl+XE0+Vg== 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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1719300174; x= 1719386574; bh=Ibzpm9Aik3fj3uXvULBQF4IHRZaL2fc2XTfdRXUb7Fo=; b=Q xlyr040qUfXcmetV68sSY1lgoz0QYiXUrOGCy8KoHq9PHmAM7getXnrGpPnDO9Mr STcpLmyct+lFi5OlLwY+Bo9yCy1P7XVXSWmAMuFqDsIeepJKHfOQrghoxU6j5ZCt VvwVUmRVRLk/GoObaMG9Hrk6tcRXxsYMKwuPifwiLa/Ekmzd2YhXcUR89nyUfAqX eQWA4zqwhBzorYBmXs9HNl6pyhFPXsjcd/Ao2agluyPAldquXHB90wL5ivu6UqPR EQW0gqiTxLl/gPB49od5SoB3uTmhqXyc/k8Qzk/5wSKVmBOZINSWjuSU18E+9EX5 s45JHWKKHuYNyFinxGQ4g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeegvddguddvudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvufgfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpedftfho figrnhcuvfhomhhmihhnshculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvg gtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpeehleffteeigfevudetfedugedtudev ledugeeugeelheeihfehgfdtkeevvefgleenucevlhhushhtvghrufhiiigvpedtnecurf grrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukh X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 25 Jun 2024 03:22:53 -0400 (EDT) Date: Tue, 25 Jun 2024 08:22:51 +0100 To: php internals Subject: Re: [PHP-DEV] [Early Feedback] Pattern matching User-Agent: K-9 Mail for Android In-Reply-To: References: <2a6b92eb-d5e9-4a1a-9548-a068ac42ebd2@app.fastmail.com> Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 25 June 2024 00:31:56 BST, Larry Garfield wr= ote: > >* There's not been much discussion of range patterns=2E Anyone want to w= eigh in on those? I didn't even notice them until someone else mentioned some detail of the = syntax=2E Like regex patterns and the generic-like array syntax, they look really us= eful, but also like something that should be standardised across the langua= ge, and not just snuck in to patterns=2E I don't mean we have to implement "foreach(1=2E=2E10 as $b)" at the same t= ime as "$a is 1=2E=2E10", necessarily, but we're going to hate ourselves if= we rush in a range syntax for patterns then realise we *can't* reuse it el= sewhere for some reason=2E My personal preference would be to keep the first RFC as focused as possib= le, so that we have time to discuss everything in it=2E Additional patterns= could be an immediate follow-up RFC within the same release cycle=2E So I think that means the first RFC covering: - The concept of patterns - The "is" keyword - match integration - Variable binding=20 - Variables in expressions (as you say, we need to at least discuss the sy= ntax for these at the same time as variable binding) - Type patterns - Literal patterns=20 - Class constant patterns=20 - Compound patterns (unions and intersections) - Array destructuring-like patterns - Object property patterns (these feel essential, but notably are the only= thing on this list not based on an existing syntax) =2E That's still a big list of things to discuss=2E Once we have the concept of patterns in the language, there's plenty of sc= ope for adding more of them, and more places to use them, but let's not be = too hasty in throwing every shiny feature in at once=2E >* No one has really weighed in on nested patterns for captured variables= =2E Any thoughts there? They feel almost-essential to me, because it feels odd to have to choose t= o *either* specify an element *or* capture it, as in "$foo is [int, string]= " vs "$foo is [$a, $b]"=2E On the other hand, in their full glory they allo= w for some extremely complex patterns, and that might put some people off= =2E As with variables in patterns, we probably need to at least consider *how*= to write them before committing to the overall syntax=2E e=2Eg=2E my earli= er suggestion of "$foo=3D" for binding fits very naturally with "$foo=3Dint= "; but if we had ">>$foo" it would feel more natural to write "int>>$foo", = and would that order be better or worse?=20 Regards, Rowan Tommins [IMSoP]