Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129959 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 26E121A00BC for ; Sat, 31 Jan 2026 03:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769831731; bh=D5qnKE8BfxfFdIRhj/5q1lPWWhX0Y0N99+FnlGhKODk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=IzgnT5gOKe5QmchdyXWHTByfy7bT+XZ3PqU3xjJZgifzNWbK6xgQismhJyBkhVz77 mwnQSEbVnqxycXYPLy4GZZg7NXDHIapK0GzLyrInpvmmadWpI/Wfn0oURYa6iqNiMT QGsh0jjeumNQiliTQesIvJ0hUoPCYnepiyA0WpLSLJjTLstadYwV8PZ0u5krJqn4X0 qjLM1zfGvvlee3Oh7P82avQFd34SWfgs+qQWfg6SJVpT7mLxr9oY/nm724gIabv2wK dnO2+YpmJ4tI/TxyKbQNkQJTTM8wB18PU7wUc1DLgWMZ2NNfkr+3HvWwBQ9QnwEo8n ZTN7iSyn/cDCQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EBDC5180050 for ; Sat, 31 Jan 2026 03:55:30 +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.9 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from AM0PR02CU008.outbound.protection.outlook.com (mail-westeuropeazolkn19013014.outbound.protection.outlook.com [52.103.33.14]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 31 Jan 2026 03:55:27 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KujylJBop8NBvzzWtReeeEmXYjzxtPzWOn4qWUWUrC3k37KUQ3w3s9L5SeyWV03jXrcwRa9DDSlzaUo4m4pm4DBzpoRNfBjzlLY7QXTdZ+eEXu48MX0K/7RPomIsRNOU/3VF75D5M4A+tHk8SqheleLp44YMzic/Z7gcovYSEOCgHfSJ3lel19j/3soelyTJmLr/VPIawHUcBF7RjCcFtt0bGtYkdvQ+DibhgSpB7GCRrtnxhapF0DN6hY8c1zUVs2EcgHnElX3DQanoLEbNCuH/PLAmxOJu+cXuby6yBMiMWdfQGMcJ1TVWDE306yNKExx2M/uh2C2bU5ZgOEbzEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Ld+dFRMuCEwiXyGOXrPtlajm/9JL0BvfHVj8hSBFuXQ=; b=CTf+RorvIKUFlUf9G07nasNPisCw+CdSOgz2JJxwoxEgISPnP29ZhAcwZzxzWKUNEjhzmYimki1KUB/jZTVGI1w6MARp5qcvyUjglLAEqlzlDLGk5W9agmcDaPokan41jEEJOg1cYCkfhgX+ejg2+636VsmiX0eT/IsukiLteqrD5z27CqV1VZRpW5FJTx5NeWp/553xjsU25Higv14GIU7FJBzLwkeIbkGS9zyxZvfXTIIBorwyhN9bLGLcGJ1lFa3BYqwLMHuk3KDoVcyg/0/HJOzTc3UhZR3Ev8wu0s9aeVDP9zgcp0mlSPOowp5GpFz45Chz270Ww3wWlAvWrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ld+dFRMuCEwiXyGOXrPtlajm/9JL0BvfHVj8hSBFuXQ=; b=idh51H56eImKE/608uTd4uKOJVWYPBBE3Ru1QPc2aa1D1gFDsV90gC4uLqCgHMT0lhWdoRVi3RT8T0oDA/vPk1pn3oJGLCtxVxxVOw1KNUZxCT5oE4d/KIXF2FsMl5h5ZDidoZih51s8sxbJoG6pZ6T6xePVabc4xZcwo5KkqXbbhVPhxFSYePT57Y7hzV4deqB3ion4pqx1bCaYgdjDS7XeVNx5PhONGvNnKpworhwD/YGt62RTf88HENt7h/N26DJKWaJHrid7ZAm/ueg1uXhLOTKxJGU5z9Df9sB1mVQWgJhV2N4aHDzassnsYpxrLHFKkg1braLGCZUxq+HhLg== Received: from AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) by DB4P250MB0831.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:38c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9564.11; Sat, 31 Jan 2026 03:55:19 +0000 Received: from AM8P250MB0170.EURP250.PROD.OUTLOOK.COM ([fe80::6d50:e32b:6064:8801]) by AM8P250MB0170.EURP250.PROD.OUTLOOK.COM ([fe80::6d50:e32b:6064:8801%5]) with mapi id 15.20.9542.010; Sat, 31 Jan 2026 03:55:19 +0000 Content-Type: multipart/alternative; boundary="------------fo0XxMb447gVEPvAfp3u9gyU" Message-ID: Date: Sat, 31 Jan 2026 04:55:18 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] [VOTE] let construct (Block Scoping) To: Marco Pivetta , =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: php internals , Seifeddine Gmati References: Content-Language: en-US In-Reply-To: X-ClientProxiedBy: FR4P281CA0038.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:c7::7) To AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) X-Microsoft-Original-Message-ID: Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8P250MB0170:EE_|DB4P250MB0831:EE_ X-MS-Office365-Filtering-Correlation-Id: 3cf889cd-17f5-4d5b-1275-08de607c8cee X-MS-Exchange-SLBlob-MailProps: 9IecXKUgicB5Y5xtj3Bi4po1AHQXatGh88q+xQ41W6khuVQb5LetJM5ltP8RI6MiKYDvDuM24Wy21vn9PMj7k3cDJe9V4DDTTtUiD60QGkG++RAOGwpUUP4yaJnGtxmZ/QpNkKwN38s/K03nJ7a/XsqyWviL8qqyAahhq31Bbv9z7DPgpzSFObItQ3X28LMC0IJyP7przLI/4G3AooUowFQfVqsJffnAJhRBKZ2NJsvsANK4XdsrvH9Pd+FTMsicc1YEeiDr3qHWAWwGdCLRSooTvjOkmDohUCGY2WxKN4r3UgzE1ZQcD4tP07Re8RPhCTC37daQeaTDzNKSSXU9LpoItknSAgQ8oK+9c6QPHLYitJNtBTM/C+4Rm4oTfkB9v+oTGiFIGrPozT13JAH1D64yfUTFPw32m7SyRGTgQDCvV+iv+e5VFAYgbxWY1rcwbab2PH9BBvowQsmd/LSxKWtX7f38Lr9s88dGI/OZ5zFr7r1ofvtmksWPkLeUdGNeYc7py7U2HttYV2MZdCab2/VKC/xhHs0E8du6FEuXflWJqpvjZjaN80R2UthtNpxgSQjcgitUrXUAUHnqhldGcGzuoGw9WIsuvRPP83TDRW3zu05QgrrpbzudlSXCDM683DhqeTTp70Ocz2+0XrpK3Oppq8g9O+OsLStd1NmNdAKEUqmvvkgBLcVjwGdgZAGyuoY0tVI0LVXdzVtgyZtWc/tzLltEom3nIhRQPTPvrb3+Y3Ov/1uFgg== X-Microsoft-Antispam: BCL:0;ARA:14566002|51005399006|8060799015|12121999013|15080799012|23021999003|461199028|19110799012|5072599009|40105399003|440099028|3412199025|26104999006; X-Microsoft-Antispam-Message-Info: =?utf-8?B?UGxYUjBuSjNmMEJwcEZmNitqOEw3MmprRlQ2V3FwZ2E1cDcvamlLTktyMUZD?= =?utf-8?B?TDdTY1YyYjRkQkdoNTVJM2VEM25NS3J3MEFFMzRoM1hYV3J5L3VSeUNGQ3JN?= =?utf-8?B?L0JpYUNHa2I1YStTNWR3N1JlNnp6T1RHQURFdlk1cFBzQmNLSmlKRWJTQUZH?= =?utf-8?B?N3JaN1hKcUZpdjRtWTR4dVhiRzdMQldDQ3ZTNEQ1TENONlAwOU9nblZlQkl5?= =?utf-8?B?Yll5L0M3WGx2aFVqdkE2SGZRZXYydTY5UGNob2Q1OEQza0RlTVA1TWNsck84?= =?utf-8?B?YWQwaXpOY3piTE1pelVrK1VweUpyaDNhVDl0TmRjYkp5aDNLWGZXQkNQL0hI?= =?utf-8?B?VmszMTY2ZmJCazR1TFVzd3JTaGNJL3N0cEtYZlpwOXZvcHlnM2E4dVdMQUZ1?= =?utf-8?B?cUpZVDVaSFFKVTVSN3k1UFVSYXNFR0lweEM5OGVHRFRLb0ZGYUpUc0oyOXB4?= =?utf-8?B?blcvR2c0ejQ1MWVSWFR0bktIQ1BWR1ZaY0xxT1pQSjNHMVZTcFgzakR2U3VP?= =?utf-8?B?ay8yUTFqME8wRFV5RnA0MEpuSWhPcVVMMlRxOWh0dVJLZlkxMTNsSGtqd2g1?= =?utf-8?B?ZjNxTU9TQ2dDZGtYdFQxNS83cEdaZlIrZEZqQk56aHRFT1A4MjF0bEpPL29P?= =?utf-8?B?RlNyaHVodWV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utf-8?B?cTVKb1BuUkN6Rm1Ocm1KTWdrL0tkTVFMdGRUT0phbjFJRzN4MXVTTHpQWUcz?= =?utf-8?B?cHNsdVcvZXJ0ZU1PcGE4Y0ZoeXpkd0NkNDVMdGRucGhDTVE4eGY1VzBvZmxF?= =?utf-8?B?c1FoTzE1bitKY3JVcGFuRENES0ZoMWZ3OWVldDNmZnF4Zm16aWtDVzdDWitQ?= =?utf-8?B?NmcwNFFOTDY4Q0hrQzdib21mZG80b2VVSlJaN1ZldE9VZDVvN3VZYXIyVE1n?= =?utf-8?B?eEhBNk91SFl6RmRtZUtjYTdkaEpneEl3N2ZPdnRSejBrUzJuL2Rld29uU2Jm?= =?utf-8?B?eWxsZnpiNm5aNERTSXNTak91WnJtRjZNVXdSVEFOSXRDTlBWbTFZRytYV2ha?= =?utf-8?Q?I7mZtu13VEe2NnRCoXwoG3GFsJsyEuij?= X-OriginatorOrg: sct-15-20-9412-4-msonline-outlook-eee9a.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 3cf889cd-17f5-4d5b-1275-08de607c8cee X-MS-Exchange-CrossTenant-AuthSource: AM8P250MB0170.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2026 03:55:19.5388 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4P250MB0831 From: bobwei9@hotmail.com (Bob Weinand) --------------fo0XxMb447gVEPvAfp3u9gyU Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hey Marco, On 27.1.2026 13:45:06, Marco Pivetta wrote: > Hey Tim, > > I went for "abstain". > > I'm a proponent of functional programming paradigms, and I frequently > touch Haskell / Nix, which have `let ... in ...` and `... where ...` , > which are nice. > > I feel like cluttering the PHP language for something that is already > (in my own opinion) resolved by IIFEs (and inlining/optimization > thereof) is not necessary. > > I don't mind if the feature makes it into the language, but I feel > like it just complicates the AST further, for very marginal gains. > > Greets, > > Marco Pivetta That's pretty much the sentiment I share. It's additional complexity for the language, with a benefit not worth it. I definitely prefer this over context managers (though they don't solve exactly the same goals, there's quite a bit of overlap). But for me I'd like to see neither. As to the more specific semantics of the RFC: It's not natural to write code this way (especially if there are multiple such objects created across a function - you don't want to nest 5 times, for 5 objects), and there are only very few instances where it actually matters when exactly a value is destroyed. While the examples certainly correctly show usages where it's useful, an explicit unset(); just solves this as well in most cases. However a let() is much more implicit than the actual unset() telling me "I NEED this to be cleared here". It also doesn't prevent me from outliving the value. It feels like let is supposed to be clearing the object. However, with your example for process_file() it's fine. However if you have zend.exception_ignore_args=0 (as you should if you disable displaying errors) and forward the $file object as an arg (e.g. read_all($file)), the $file object will be attached to the exception (being an arg). It will not, as one may expect, be actually freed when the exception is thrown. That's subtle, and let() isn't the holy grail for solving these things. It creates false expectations in sufficiently complex code. The main remaining utility I see in let() is highlighting intentions, rather than being actually useful in the language. Which goes back to the first point of "additional complexity, but not worth it". Thanks, Bob --------------fo0XxMb447gVEPvAfp3u9gyU Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hey Marco,

On 27.1.2026 13:45:06, Marco Pivetta wrote:
Hey Tim,

I went for "abstain".

I'm a proponent of functional programming paradigms, and I frequently touch Haskell / Nix, which have `let ... in ...` and `... where ...` , which are nice.

I feel like cluttering the PHP language for something that is already (in my own opinion) resolved by IIFEs (and inlining/optimization thereof) is not necessary.

I don't mind if the feature makes it into the language, but I feel like it just complicates the AST further, for very marginal gains.

Greets,

Marco Pivetta 


That's pretty much the sentiment I share. It's additional complexity for the language, with a benefit not worth it.

I definitely prefer this over context managers (though they don't solve exactly the same goals, there's quite a bit of overlap).

But for me I'd like to see neither.


As to the more specific semantics of the RFC:

It's not natural to write code this way (especially if there are multiple such objects created across a function - you don't want to nest 5 times, for 5 objects), and there are only very few instances where it actually matters when exactly a value is destroyed.

While the examples certainly correctly show usages where it's useful, an explicit unset(); just solves this as well in most cases. However a let() is much more implicit than the actual unset() telling me "I NEED this to be cleared here". It also doesn't prevent me from outliving the value.
It feels like let is supposed to be clearing the object. However, with your example for process_file() it's fine. However if you have zend.exception_ignore_args=0 (as you should if you disable displaying errors) and forward the $file object as an arg (e.g. read_all($file)), the $file object will be attached to the exception (being an arg). It will not, as one may expect, be actually freed when the exception is thrown.
That's subtle, and let() isn't the holy grail for solving these things. It creates false expectations in sufficiently complex code.


The main remaining utility I see in let() is highlighting intentions, rather than being actually useful in the language. Which goes back to the first point of "additional complexity, but not worth it".


Thanks,

Bob

--------------fo0XxMb447gVEPvAfp3u9gyU--