Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129872 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 1F83D1A00BC for ; Thu, 22 Jan 2026 17:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769104646; bh=ZgCQ3BE3Ax29HZHgG/HeZNgmcK9/JfAOH9n7bLIUwFs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Kg26YzbnZweZQh/ruKMe4oo5MVT/ScpZ3tMBebWakP8mPdH/xT5K3HNBaLWCWhqC8 m/AJOmiw2iCzknNLt7R+ubUgN/1/kiXQbxjeFixQoOud4k6K8tL5Q7glCggT4eSN9D gSJRrsM28x7tMwtbBG6JGy0uiLQjuHDToGuRMXluh6aMtP/T0dRTp6C4OWxakPhTex PyVsQLKkcLpBWBrGH74GMs4F8XbKhuZ6ztUxcgg0VGFoN/28yZdu/Dt9g4kjrdTJSA sRJ229WJgPt96NgtxrsABB3e4eTc7OVbVW3c02Oj/bUQCjkAyj97u5rS2TtpLeBZWp Dp8Tiu7Iet7Gg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E422818073A for ; Thu, 22 Jan 2026 17:57:25 +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=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (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 17:57:22 +0000 (UTC) Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-65807298140so2018113a12.2 for ; Thu, 22 Jan 2026 09:57:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769104636; cv=none; d=google.com; s=arc-20240605; b=K4fquPS+xPb1hB/apCQ2cH80FohGEQ7PUNzQtb/+G3O9HWOzILQ8HveAwyQUFdmnMc BWl7cwa3mWPmPa5TvJM/6omOXLovdALX5y2ZxmAj3PWck3u1XdvO3V0oxmtIn+QCZOaQ uKBL1//uViwqlHJk00pmNJ4PS8TW6tpKxi/hfHqb+uQ5u1vZdWi7J9fjBdj2Edq3HH2H /fjjR4JRNgiPd6P0LH7zUVCDroIP6g4Q7GjUDh9GDTE/2vrJaCxJrS4QJ7CbMKmVo+Ic LlcDlHdE86WaCxruPrvL0uU4iS+boJZ6ryT0S+DCmlANI9XAIVXUmVVDreEEiP/dPkxF Dlmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZgCQ3BE3Ax29HZHgG/HeZNgmcK9/JfAOH9n7bLIUwFs=; fh=cH1YbWrWMJnZKzyQQQ7vsfoba+WtITnYp/9t2Ep/xIw=; b=FJQueNFz5h5NNwxwqnYxSBCwqXlUVtwHo7bM5XbeIMcu3P5eQL7c7LX8P2UKO8C/eQ lDUcDW5hRwJ0tijnLkiNqMJiccMI4oKje7B/iSr1O8+K82fr9rc6U2jX+l6F0dos9/SQ oiDZoATtKHbAnR60DAVj1pU1gQIhfn77OWRS0zPKY5Snke2i0H6aYPsgy8CtlM4Zjz9z JdjZnFfJNLOsfN4v+qDdsDxkEG2S70Q7TICPChaxpS88q3jdE/fwJrd/DK8cKnXiGgDD JJ7SJSkli3XFtqixHUcSIfKYa3Vam7rof1NQVi1YGy9jIy+a9cF04ZsLrzCTCY4OWuK8 Otfg==; darn=lists.php.net ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769104636; x=1769709436; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZgCQ3BE3Ax29HZHgG/HeZNgmcK9/JfAOH9n7bLIUwFs=; b=NIgkIdPbdwMHL7qC7eV9jGLgb+B7YQvFSA2aCG5I+3msPwGgszO40rQHx1FEKG9iqu KFtzVb0w69nFSfiVxY+lukTOnZBgn5eldkvqTqLsnmHr97e/90AgP6rgt+WnMn9BAGB9 d8oE/Ie8TXl0QEmLjkGs8rfF12WMNh55Ea3IIO9mq2G0xGizv4ppV1Ccw2p8XJgxx+zr KoR1Hsp0WLz492kEs1+CroIDIeZEmJ5ge+LPXMtjOvDstimAPFPc5FYzWukODoug5gpD RZGctQMXZbIuJ+hkV997I12Pr/wLLIL+6ADNqO0J+fJU3u2UspK9y9gxvjc7QrWP5rIW fmcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769104636; x=1769709436; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ZgCQ3BE3Ax29HZHgG/HeZNgmcK9/JfAOH9n7bLIUwFs=; b=CVVQ567gyUv1uo+oCxh3m4fwUSNDLokvRmgDHuB96rH9CNDaIJDAgpZ2L3yj6H2jI4 RCUjVxkBfcC/P/76LIJR0eqsJggA0oUNEUxhp0Gk0Ljy+DUil8W7QKytSnVJeDWCJOdT CpAQvpPtlfcULSXjR2zkylOc5GCYW7362d0fGKBUdftjszXEb6ASMjTrOMTQ3b0o9XC1 cqvnVXtX4KvTF2GrXsyW6d3YUHSzmj29wj+E95MzL6Ei20o99nORd5m1Niv660NIcwWm fVtRhtMtD5oKhB/YOblAzh9ur0Wujr+L8ya0drBtqGCAs6M7BeE0IVbdL4kFzNgbnKYg fmNA== X-Gm-Message-State: AOJu0YzpSE9zB0evw4hZXWNGtkm2Zg1h1nQqzJaucRZbstE6cn0XLvtU iIJj5TnocyovQsViLh+2NY5t5OQ4S/OA2MHyJPrc83SfPLCyGQrokVexfDLgYaKCZN++HVysSzu wG2HlRrv9DguzHEGVxW3ArpsyDTkka0D4XEDn X-Gm-Gg: AZuq6aKWktbRgrmDzyRO94sduwLMNO5Ln8rK6fwuWaC1A8q36Ujp9yep4E8BNpZcPBZ Yg64HxkE5puyjrlGa+3QwVe5v6gN9M3rT2ovzhvkqk2OuwBAHjGQghHaTQHfSIoCWkhRFlJhIWq i8vznix6MENDaohbO9UaBJ/+TPa8fjksmsFEuPnnyihFCcqmq8i6HmhmizogBKyBWVJS56tp/pn bJqfpoKbeMjO/WsoCjJkurGPXFKa7YX2MzBrwpJvR1WibnAfawNV6fSV1gbNTYp/Cf+7Us5HHKG 07tT7g== X-Received: by 2002:a17:907:d0f:b0:b87:2f29:2060 with SMTP id a640c23a62f3a-b885accd4dbmr6584766b.26.1769104636037; Thu, 22 Jan 2026 09:57:16 -0800 (PST) Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 22 Jan 2026 18:57:04 +0100 X-Gm-Features: AZwV_Qh6LdMJPpppX7uWBFVmBVuACYI_s_Lb457qch7BahwjHXxQDm3wxVM3ub4 Message-ID: Subject: Re: [PHP-DEV] [VOTE] let construct (Block Scoping) To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= Cc: php internals , Seifeddine Gmati Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: arnaud.lb@gmail.com (Arnaud Le Blanc) On Thu, Jan 22, 2026 at 10:17=E2=80=AFAM Tim D=C3=BCsterhus wrote: > > Hi > > we just opened the vote on the =E2=80=9Clet construct (Block Scoping)=E2= =80=9D RFC > (which was originally proposed as =E2=80=9Cuse construct=E2=80=9D, but th= e keyword > changed as a result of the discussion). Hi, Thank you for your work on this. I voted no because the RFC is presented as a way to dispose of resources immediately (quoting: "This feature provides immense value, particularly for modern applications built on long-lived servers, where disciplined and immediate resource cleanup is not just a best practice, but a necessity for stability and performance."), yet it doesn't in practice as it relies on reference counting as a proxy for cleaning up at block exit. While reference counting is deterministic, ensuring that a value is uniquely referenced before leaving a block is impossible, and cannot be enforced by the block itself. In practice, useful code will send the resource to other functions or 3rd party code that may retain a reference to it. Moreover, there are many non-obvious ways in which a reference count can be increased or a value=E2=80=99s lifetime extended: exceptions or backtraces may capture arguments, fibers, generators, or closures with non obvious lifetimes retain their local variables, closures tend to create cycles, foreach variables are not always unset, etc. Therefore there is a non-zero possibility that a let() statement will not in fact cleanup the resource, despite the stated goal. Fixing this later would be a BC break as people may rely on this behavior. The RFC refers to similar constructs from other languages, but none of them rely on reference counting for this purpose. I'm not aware of languages relying on reference counting for this. Best Regards, Arnaud