Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129841 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 B3EEA1A00BC for ; Thu, 22 Jan 2026 09:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769072943; bh=tk+7A3xHYFHh4fGGfTDk4qVO+bFS4LW+d+R8iYEIDKQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=d/54pYgYerNTbWbcKswRXsQztu6uUmnlP2J7TCvffnOR+GKIAQ+KWPgyIS11cxIIO D4oR8t8e+lLR2OcDpNQVe+QnNNjZOphtUEoNqh6QkUe+X8kqvDXpIWgbwMKtiOmPqj +CJmTTQGfKgGLVzQ5M32ifXwea2dEvQF5x0tAbvejbxJw3QTBCKsdnlk94/iFZrqxW 2d59kr7R6ZbRkL6EX6YmcvrA6/byZbkv4KP5Y9tq03mOwt4FlmvEZsp+btgGRHrsnP 05X92yrksUSFJNyMepuQnLzsbR5cs9fb0NsvvD/ZlWW8aQxTAf6ue/F+b+B8Yowqrc hMsT+93vQFEZg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 84714180083 for ; Thu, 22 Jan 2026 09:09:02 +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 ; Thu, 22 Jan 2026 09:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1769072936; bh=13f4e43fidyUhR4B3JLFzQTDpIIQiycjm4Op9pha9NE=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=YbBASVXidkTHv2V6F83TrjTu4FyO0lhaoLJVvj0YVZLcd+TkHR0KFC18qV/YI97Bz L6rH+pbRFnhfAyshVzHz46cO8Fan10JGofmxMurkBSxaTZGweVdPX1y9tsPfsx/tGB kRn1QbVqnGEQWCyF5YhoboY8fsMVJgd7YYzpwsedBLpyol82+Ll+Obzv2/9ZcE+z4X XD4o2i2XFC9EhYtvf2WfFpTsfOmzOxXOpsBtmoHaMiTBZ8NBXTUHvmaVSza3MWxO7i 9PVa4jo+o3oG80TKJkLC5dRr8chJc894MdezwdmmDEKXBKA3SXLQhSVrFw+aGiXnvX N6Y7DLWa6ssRA== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Thu, 22 Jan 2026 10:08:55 +0100 To: "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC][Discussion] use construct (Block Scoping) In-Reply-To: <323651a4-f4c5-4a93-bddb-0986bf01eef8@rwec.co.uk> References: <1F3473C7-5D83-48D3-964E-A63D6F44D21E@rwec.co.uk> <4998b4c6-0474-4f0c-b63a-9909b8acfa96@bastelstu.be> <018421f64342a0d960589b4c8eea5cc5@bastelstu.be> <84b9dc16-3eb3-4283-b015-3af29fc0e55d@rwec.co.uk> <590fa655-d170-43f2-984c-d0a5ff6c30e4@bastelstu.be> <7c623161-cde3-4fc0-944c-ddfc2785c845@rwec.co.uk> <21f12343-b212-456f-93b3-079810d3d76d@rwec.co.uk> <7da06511e359f73410032a03757dfbe4@bastelstu.be> <323651a4-f4c5-4a93-bddb-0986bf01eef8@rwec.co.uk> 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-20 23:26, schrieb Rowan Tommins [IMSoP]: > As discussed on the other thread, this part of the discussion turns out > be moot, because exactly the same ambiguity exists in the proposed > syntax: > > let($foo = bar($baz), $baz=1) { ... } > > The syntax alone doesn't tell you what that will do, only knowing the > choices made in the RFC. Yes, syntax alone does not give you any guarantees. But it provides an indication of which possible choice is more likely to be made. That's also why I tried to emphasize and explain how the different syntax works with my intuition (e.g. by using “suggests” or “strongly suggests” as the phrasing). You may disagree of course. Different brains work differently and different experiences with different programming languages probably also shape how one reasons about the code. >> Other languages have other ecosystems and other user expectations. PHP >> has extensive “scope introspection” functionality by means of >> `extract()`, `compact()`, `get_defined_vars()` and variable variables. >> Folks are used to being able to access arbitrary variables (it's just >> a Warning, not an Error to access undefined variables) and there's >> also constructs like `isset()` that can act on plain old local-scope >> variables. Adding semantics like the “temporal dead zone” from >> JavaScript that you suggested in the other thread would mean that we >> would need to have entirely new semantics and interactions with >> various existing language features that folks already know, adding to >> the complexity of the language. > > > I don't think most of these would need special semantics at all. If > it's an error to read from $foo, it follows that it's an error to read > from $$x when $x is 'foo', and an error to run compact('foo'). I could've probably phrases it more clearly: I don't think the existence of a temporal dead zone is a good idea for PHP. I find it especially unexpected to be disallowed to write to a variable (i.e. more extract() rather than compact()). >> For me this works, because the `let()` is preparing me that “this code >> is doing user processing” and the `if()` is just an “implementation >> detail” / “means to an end” of that. By the block scoping semantics I >> know that when I read the closing brace, the user processing is >> finished. The function is a

, the user processing is a

and >> the `if()` is a

if that analogy makes sense. If I just want to >> get an overview over the function, I only care about the

>> headings. > > > I can't think of any situation where "this block of code contains a > scoped variable" is more important information than "this block of code > might not run at all". Note that the quoted wording said “this code deals with user processing” not “this block contains a scoped variable”. The variable *name* is important information there and knowing that this variable name will not be used after the block is important to me, because then I know that user processing is finished. > In the analogy, I would always class an if() as an h2; it's one of the > most fundamental pieces of control flow. How the user is being processed (e.g. conditionally) is then the h3. > I think, in a nutshell, this is where we have opposing opinions: It looks like that. And IMO it is totally fine. If we always were in agreement, we wouldn't need RFCs, Discussions and Votes and would just commit to master :-) As I mentioned in the “Intent to Vote” email, we nevertheless found this discussion very valuable and are thankful you took the time to engage. Best regards Tim Düsterhus