Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123796 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 E53B01A009C for ; Mon, 24 Jun 2024 23:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1719272016; bh=ncHcic74WpjoX56dxjN5a8Wv2BzewWlFjWyqWgWeelY=; h=In-Reply-To:References:Date:From:To:Subject:From; b=CYaTjWA2SzrEs5T1aHRBGvOOnnDiH1XEo+QOyEvXh6wUqcr2HcoofbOvvDtbBsVbw RYHM1ULvSFDJezempwlp0SXi7DZEgWOkndEN3NtJz1VdIjbd4BABlr9wdefpE5AcbI J/JDXziHQ6z4Vuxrl8M3thynVwBlBc/+mvhimWSJ/R6LH05HsEiqhH5kCkiElR7DED kwa5HUAVcFqYAKfXZunMzlkEL6mOd0hYoanspbYXLYooRa2hTCk6t1BbsZAjFbWTgv Z7SBZbFXmyQVSF98MtMI7G8lRTzbfJulJiCs9Jr+Y3lsQ84isPpA9vcTccpAZRoqwK lZFQFUFsAhHRg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4FF22180068 for ; Mon, 24 Jun 2024 23:33:35 +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, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, 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 fhigh6-smtp.messagingengine.com (fhigh6-smtp.messagingengine.com [103.168.172.157]) (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 ; Mon, 24 Jun 2024 23:33:34 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 86F3D1140172 for ; Mon, 24 Jun 2024 19:32:17 -0400 (EDT) Received: from imap50 ([10.202.2.100]) by compute1.internal (MEProxy); Mon, 24 Jun 2024 19:32:17 -0400 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=1719271937; x=1719358337; bh=sKN2uIEVdQSUJuBJJbKEh ybq6A2gLv/jw2+Bg+xvkdc=; b=OOp4IrK3msdiYZ9WW0/puSI9mSNxmhDEmArK0 5OEiv8AMRNg2MnW8KiAXa+grhrUEnYBBZe6h4zuhOyXa5WAvTJuzJ86LsqaWCeYL Yf7IZileNDLq31bHIP6n44+HlvJi7bD6QWVdLXVe0TwwbliO7ae2MskAd2RAPWEm OzC5sFnupfGq6zrr1J8eZl8ypw+hz0gZSCcUy/k1TNwGO/OflKrSIZoetwPMmP1q R/O7NsSQNDKKK2YZ3edBe0nHGpyZZVHInJA08001T8QFuntR+9vb2q+IwB3+vlnt DSd+qioiO1MlEmlYMgAiPoUa2aND8zM1GCgW+SynBFOUdH4sg== 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=1719271937; x= 1719358337; bh=sKN2uIEVdQSUJuBJJbKEhybq6A2gLv/jw2+Bg+xvkdc=; b=n PWYRtq37F5WAt+cicEYgeWM8OaFjUEdR5yi9zbCp/fkUpePPZ8k+rzz85QZhhBoh nFirFzq16v5xwqV1xg0f7JzScE853MZ/on1Xyp8odYIJA5S2VvKFNMzpdS7H+Hoa JmSwwBlzkDdurxbIuD21k+ux8FJEQzqyohalElAjyw66a4pIs1aXOpW9+ZMsq1FG c+Sxd4jkAOP5qTkDkw53VvEQu6Dl7K7EWY3e9IANVYDTTbaCjzPTWdYQREFUkJQv 8xXKVajAqX/OKbdli5GqXJPr4FdTbA9t4Y0UeTQNnWPWqEP1Ib5FcWN++4EzOGqJ oeKcTvmZLLc6rEdueRErw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfeegvddgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfnfgr rhhrhicuifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtg homheqnecuggftrfgrthhtvghrnhepgeeghefgteejheeggfeghfelueeggfdtjeeivedv tefhveeguedufeelhedvteeinecuffhomhgrihhnpehphhhprdhnvghtnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhf ihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 1F5F11700093; Mon, 24 Jun 2024 19:32:17 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-538-g1508afaa2-fm-20240616.001-g1508afaa Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Message-ID: In-Reply-To: <2a6b92eb-d5e9-4a1a-9548-a068ac42ebd2@app.fastmail.com> References: <2a6b92eb-d5e9-4a1a-9548-a068ac42ebd2@app.fastmail.com> Date: Mon, 24 Jun 2024 23:31:56 +0000 To: "php internals" Subject: Re: [PHP-DEV] [Early Feedback] Pattern matching Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Thu, Jun 20, 2024, at 5:38 PM, Larry Garfield wrote: > To that end, we're looking for *very high level* feedback on this RFC: > > https://wiki.php.net/rfc/pattern-matching Hi folks. Thank you to those who have offered feedback so far. Based o= n the discussion, here's what we're thinking of doing (still subject to = change, of course): * We're going to move `as` to future-scope. There's enough weirdness ar= ound it that is independent of pattern matching itself that it will like= ly require its own discussion and RFC, and may or may not involve full p= attern support. * Similarly, we're going to hold off on the weak-mode flag. It sounds l= ike the language needs to do more to fix the definition of "weak mode" b= efore it's really viable. :-( On the plus side, if the type system itse= lf ever adds support for a "coercion permitted" flag, patterns should in= herit that naturally, I think. * Array-application will also be pushed to future-scope. Again, there's= enough type-system tie in here that is tangential to patterns that we'l= l pick that fight later. * Ilija and I have discussed regex patterns a bit further, and it sounds= like they=E2=80=99re going to be rather complicated to implement. Even= assuming we agree on the syntax for it, it would be a substantial amoun= t of code to support. (It=E2=80=99s not like types or literals or range= where we can just drop something pre-existing into a new function.) So= we=E2=80=99re going to hold off on this one for now, though it does see= m like a high-priority follow-up for the future. (Which doesn=E2=80=99t= have to be us!) So let's not discuss the above items further at this point. * I'm going to do some additional research into other languages to see h= ow they handle binding vs using variables from scope, and what syntax ma= rkers they use and where. Once we have a better sense of what is out th= ere and is known to work, we can make a more informed plan for what we s= hould do in PHP. (Whether using a variable from scope in the pattern is= part of the initial RFC is still an open question, but we do need to de= sign it alongside the capture part to ensure they don't conflict.) Stay= tuned on this front. * We've removed the dedicated wildcard pattern, as it's equivalent to `m= ixed`. If there's interest, we're open to having a secondary vote to br= ing it back as a short-hand pattern. It's trivial to implement and we d= on't have strong feelings either way. * There's not been much discussion of range patterns. Anyone want to we= igh in on those? * The placement of `is` on `match()` is still an open question. * No one has really weighed in on nested patterns for captured variables= . Any thoughts there? * I=E2=80=99ve seen a suggestion for capturing the =E2=80=9Crest=E2=80=9D= of an array when using =E2=80=A6 That=E2=80=99s an interesting idea, a= nd we=E2=80=99ll explore it, though it looks like it may have some inter= esting implications that push it to future scope. It feels like a nice-= to-have. Thanks all. --Larry Garfield