Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129913 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 36BEE1A00BC for ; Sat, 24 Jan 2026 18:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769278586; bh=Fh4caxBn3L7fKSmeL7AcByRH8ucbiNdeDU/QqoJ1T60=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=cy/tqCbJ77XerMzgUTUMzzqa6c/xm7lIRLz7en65gD655WVla/+G9SmCGAbUtqyzr QOCBqElo6ZfaajsgbNJStqadevG2z9MehLFyNv2YAoSldK8rtVE/DYFFgLIDDEUgwW bSlw+f+wPONvt9iV6LYMwlIO8U/NXY8ydTJaISD5CAEPPNiGoes8xA0KRvpf00TQz3 Q7w6eEn1Ix6S5Qw3nm4ln0GFWCL5lZUhS8nEyV8vHPFnWfeYgd2egQiMKmuxu4EVl5 8Ys/MRJVPEYywgTqES4JGPH+0TivSeNBmDGTuYx+AH/lc1nbiVJsjFGODPeaX1Gklt r6T+T+MXqlGdA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0E11B1806A4 for ; Sat, 24 Jan 2026 18:16:26 +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:16:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1769278579; bh=0p4fYtNf95l4BjxTr8fwHZNdkIxOtCY7HXVjnyXCemQ=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=JYdPxEodC3UcEOV9KPkbZTYgyjGSzFm7VbXJDbAdvr7pwTy0vSPs2a3zX6M2LrByN FdQ6p+7CXv4ohSK+JA5Vc2iwp7Xa6Dq/FFPgn+BSG5kw3CRV30GmLlpAdKZttiuaoA Lplmka5MzXpL8idpw9nJUtPian+B7uqr1ihVCwSzZlOisM39zcZx5lkLRdlZP7BZHE YR3UrGYR69YK95Js+FbISXIFD0giHutAz1uRPLdA4omNOeWI9h9qrQpjSwCbDBuDsq vbyRE7gfZjMLUDnKYextUPgpRDRRY6D+PTbT6llMK5ID4Jm07dg7KHVsnoSny/1pFJ ywQnymSsUQVFw== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Sat, 24 Jan 2026 19:16:19 +0100 To: Larry Garfield Cc: php internals Subject: Re: [PHP-DEV] Re: [VOTE] let construct (Block Scoping) In-Reply-To: <3afc1bd6-7515-4ae7-a2d4-dd4e08917746@app.fastmail.com> References: <3665e8eb-db54-421b-8ffe-e3b1902caf09@app.fastmail.com> <48689ab4ab0bb680ff9457e406490fa5@bastelstu.be> <3afc1bd6-7515-4ae7-a2d4-dd4e08917746@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 16:47, schrieb Larry Garfield: > As currently written, yes. However, as noted previously in the Context > Manager thread we are open to allowing arbitrary values in the CM > position, which would fall back to just using that value and then > unsetting it. That would effectively replace the `let` syntax entirely > with a unified syntax. > > I have also voted No on this RFC, for many of the reasons already > stated: > > * The functionality is too limited. > * The functionality is inherently unreliable due to value escape. For these two I refer to the email I just sent in reply to Arnaud. I believe that 4 example use cases are by no means an indication of an RFC being limited in usefulness. Block scoping is a well-established feature in programming languages and I'm positive that folks will be able to come up with even more examples of where block scoping would have been helpful to them to avoid bugs / make their code easier to reason about. > * The syntax is far too non-standard and clumsy. My understanding the initial paragraph of your email is that the entire functionality of the block scoping RFC could be included in the Context Manager RFC. The Context Manager RFC uses the same "high-level" syntax of having a dedicated block for declarations - just using `using` instead of `let` as the keyword and using `=>` instead of `=` for an assignment (the latter of which was considered confusing in the discussion). I'm sure I must be misunderstanding, because I don't follow how the syntax of this RFC is "non-standard and clumsy" without this equally applying to the context manager RFC. Can you rephrase? > * Expanding CMs to fully encompass the behavior of this RFC is trivial, > which would avoid redundant and confusing syntax. The same is true the other way around, possible ideas are listed in the Future Scope. I'd also like to note that it was an explicit design goal of the block scoping RFC to compose nicely with existing control structures to be generically applicable. This enables several of the example use cases listed in the RFC. The context manager RFC requires braces and a proposed special case for `try` instead of just accepting any statement like block scoping does. Due to its composibility, the block scoping RFC is even compatible with future additions to the language (provided the future additions follow the established syntax). As an example, pattern matching comes to mind as another way of "writing into variables". Block scoping will just work with match: let ($x, $y) $result = match ($p) is { Point(:$z, :$x, y: 4) => "x is $x, y is 4, z is $z", }; to prevent $x and $y from leaking out of the `match()`. And similarly to the `foreach()` future scope, we could allow `match ($p) let is` to automatically block scope all variables bound by the pattern. Best regards Tim Düsterhus