Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129914 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 EB1601A00BC for ; Sat, 24 Jan 2026 18:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769279124; bh=Y/gD3NYpdo4VGs2ARwe1/K2p27FfWuyEyaBeQMLZt+I=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=b3dilH5G8hA2ARq53u5OoD2iA4fxdolqzyplVb2UCIukDltw85O9pCv7wcGQgYBk/ xXSyEhp313n7xwRVTDNvKcVHktBGl/Ju6b9FV1+jO8EUGmW/92jmb1nsSzIwVuGEt3 Z4qKrLDpg4aEbHamXJwDZVD6ynE5auZGQbjCK8TxnA9XG61zk+3KsimR+/dtsg0wJp ZnO+XF798i9XF8NO8KdD1M2GLoD+R2Wx5kLZXQEdScnlJ6myA+/4puqG5OEZlJR4a6 1U6Rjmz3W7Knd8vxHdL6gIfJAF4OBfNYUJv9zhkOLpEdO++pMbaHFFE2RpCc0oQBS1 o+MaTNFJ/hbqw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D85E01801EC for ; Sat, 24 Jan 2026 18:25:23 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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 ; Sat, 24 Jan 2026 18:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1769279117; bh=3DD277oz+696X9mZNgtTbZL9ooZxY0Mig+kI10uMQDU=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=mBnCGpYNaHbD2dVGWqTOJJ3m3lECQ0c7YDvrU/4naxUoao68xP6QMeRnhzT9D3XCF 02wYppJ8AxeVu/aQUZ6IiODIHfL7EHiFVnTvdfNULuWGg4WNgFZZUfcJEM7Ht6YTtA jArsq+Bs5rV19WPeAq3FIrBXMVZ4OXx2fMyiIfmu9VoiybqeouasG2F29Xms/LcJG5 F/Zm2NZvhtH5Uvm/wbjvevYidV/dc+mRbPwxvZBepVXmkrRFBqTnGjs5JkqXiPMoDy Ko0E9Bu4kOPqpFSM5ZIRoaes09LvyiBN0Uj3rBPPtv1LmVLX2247WPLx/wIQFLfI5X +fy9/IYpOqVpA== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Sat, 24 Jan 2026 19:25:17 +0100 To: Larry Garfield Cc: php internals Subject: Re: [PHP-DEV] [RFC] Pattern Matching In-Reply-To: <56dce794-a512-421a-a8d2-91a9692c1ab4@app.fastmail.com> References: <56dce794-a512-421a-a8d2-91a9692c1ab4@app.fastmail.com> Message-ID: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2026-01-23 20:48, schrieb Larry Garfield: > The idea of the second being that, if you want just an identity match, > you can skip adding `is` on just that one arm. I don't understand what that is trying to say. > 2. Positional array patterns. How picky should the pattern matching be > for list-esque arrays? There's 3 options listed in the RFC as possible > ways forward, so I won't repeat them here but just provide a link: > > https://wiki.php.net/rfc/pattern-matching#positional_array_enforcement I expect "list patterns" to be reasonably short, such that `array_is_list()` would effectively be constant-time after checking whether the number of elements matches up. As such I would prefer (1) "Include the list check, accept the cost". > `$o is object(x: 1)` That would be okay, but no strong feelings. > 4. The variable pinning syntax. There's been some concerns about it > being non-obvious, which is valid. The main argument for it is "it's > what Ruby does", which is not the most compelling argument, but it's > not invalid. > > Is there some other syntax that would work better? Ilija has pondered > `{$x}`, which would then potentially allow simple expressions inside > the pattern within the {}. I am a little scared of the scope creep > potential. :-) But we're open to having this discussion, so please > discuss. As I think I said before, I don't need variable pinning at all, but `^` in particular is terrible. `{}` would be okay, but I prefer just not making a decision for now. Best regards Tim Düsterhus