Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129881 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 2BCDC1A00BC for ; Fri, 23 Jan 2026 09:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1769162387; bh=en5St2x+J+qqNBajlW17fat5pTB/ZbgIiylig5YLcyc=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=oSYJF59oZkRAjvdHH1EqtxV+dYwBSRyyY1bKyH844B2svNDmD6u8aK2GLT6qmnElB 8j/1GwHobcg9WUnIkLF/pGonqg+roGQqdKCUyqYjViU8T5/GBvOykCL3/UKFT0w3GT hJvjkjD3VGMkmIAzFYOagQ8eDyxVMnMO1oXYZZOS3mnu4M+0VISAOgI6pSGJsB34cF uhE9b6R1mRrGCHNTWcVnAelcz1sudadq6GIkdtyIJjP9PpI6g4YfRP62eVBgxL7gXC b4ZhlIXPf48wcsM3qDWk9wmlx8SqNh6YU+J5ma3z7mIJ67qPcqXiiMrpvTwtpO6+tB tAK93BIk0P8gA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7E36218003B for ; Fri, 23 Jan 2026 09:59:46 +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.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_50, DKIM_SIGNED,DKIM_VALID,DMARC_MISSING,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 ; Fri, 23 Jan 2026 09:59:46 +0000 (UTC) Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-382fb535b73so15767041fa.0 for ; Fri, 23 Jan 2026 01:59:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769162380; cv=none; d=google.com; s=arc-20240605; b=jTJUY/n3nOjkadYHJJpCp9OWc+jakrwKxkInAD4xmKlKIxKx58e30P2XidHKs6UD/6 QMTqdUjAhX3vklwAlljSxyZA0bPiceMcjHpl+CrSsp2qhL/1/eOJojzIpTUBeNe6eNAC jlOY5Ub9vEXnLQbQq9dU3Lwet0aPgL/F4jzUkpEDl/YKeRPRcmAoKEQY7yOEVkUO4QXV fHqCywyGqpCPeQOctfLPOde0J7A01WdX8isKuDn7eliIIXAm70aA/u5z2OHVmyCibO/7 zSc2JCBPEenKYYK/+RkQF8/kIDEBQZ/OxaHKIy6BtsjCzwBy92RVCvl5tH51tZS4gtwq W9vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=7YyJaeW2FvWOSzlV89ezvpSsZ4rripARwxoXwCQF4IA=; fh=WJ+qMW9k0IIobyqQ6jSDte/GRE9o5ImXNSebc2YUeZU=; b=ipNqIuq6hd07dIL6PtMMZN3mwmddJGVHl5WmWyYb3jPjaXTA+UQwdFCu8TQ+Isp1ZO OqkLIQzX5BSW68+ObcL8JLOIU2QKWjkY8rMSYQXKLqfQrsjQyt5CBPEg26NHhDM2hzZv 5Quf7zpOeRBUCNEAq8xpF4yGacpZ9awRPxhGNxSCJmtJj86YCu2x9WYBpqhCEgVnVTxB FvJA4H/cWUII2L1a3+jRVCtTN+2MAvJ+Ftc0Cgd1x7QLJ5Tx05Q73M2WO4gzarM1Pgjr LGId6CtIFzcgVith/kfs75p/fYEDavvyzkltPpOtslCWKArEzsmfY+xHZox1LiRCsYvt 0vWA==; 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=beberlei-de.20230601.gappssmtp.com; s=20230601; t=1769162380; x=1769767180; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=7YyJaeW2FvWOSzlV89ezvpSsZ4rripARwxoXwCQF4IA=; b=LiG9fps+ph2xfa2A9eWRXJajumO88/fuVpnuc0IErzSz9XVqAAJbU+IRMYLCusSaUg 2MsFCEPaWI/E87qeCZcJJbxuCaKtzljki4kv2jT7hdZO0dgtvlN4cLQ5Li3j9nu4G3EK RTd0v8o4ec9T5n3ehnfHHauNscjufw1M+2KxGOu2j1UFwYxt3cIZW7L5OxCmYQMdZ40Z M52AIc3kR0QQFNrhj1GSZh33mTinIu6ZsEyk+i6viTXGoFnIIhtRvJ2A/skz31Ic7B2/ bQWnMn5qRpnktMkPYALD1VVlGzp0NmY4pwx0A8Jksadqj+qsq4ewxMZBCXUDCgIoBiEw i2bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769162380; x=1769767180; h=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=7YyJaeW2FvWOSzlV89ezvpSsZ4rripARwxoXwCQF4IA=; b=Yzopx2zYEwVsVnZ3UvNKy38nnY4B/vcgMfSnvmG78zMjXE+WtdJiDW/Pu1eF8CQsWU EMVwVHAG/tnYwHvendJxznEgPYXieIDitX9wSbgZGhwq/KscRxXqlasxW6VhZC2vIH4l KKZhuCtAaOIMRwKGk6mHKV5GuTtMVNJvlmUCLpGDO9aUnCjNRI3NJPV2kmLphwXWFtX4 pf5jBl40nWfL2tF+FlTHapw8l4/C/Kwv9lYzeUytu0w4zULKdTJ1XDMyOcriAxZvbTi9 IF7hF6+i+iBt0RnhQ34UF4x79Tl4vX1iQ+y5q2uGp5fk9BedRnZstLdZIlgEBju/gBh9 jdDA== X-Gm-Message-State: AOJu0Yzp9loMOge8JtB0gcx2Pp5ZkyWxXKvMZoa63Zrk0LHSAbC8ip0F BdWBn/yeFTGp+aJ/isRgR539qzU6eQnIorNhNFR1H6lqCjHNk6dU8MP8VN46IOzcr0yhliY7yca AHi7RQHNM48JMh34IF2qIRssx7gxFvS/qSnJ5Rhnx4g== X-Gm-Gg: AZuq6aLKHyznJKbZl5v4B8fTU9pplJS0BKmFcyudorHr18wavLfr8D/b0Hlo1qOZDDj GPf7p8f2Rca+5kWATeqS/QuPL+V/ucApYH54R7FwSu2UG0l4IurZcuqJV/9fm42fggBrE/8uJF1 LNvakGSHHkjEhzKgzc2OdMMa59R6fb2+51gJd6Qtz2ONt715YVVNLalBzJuGs7iIPjaXbIF/s2w o/PBEtCXHP3HFeZdPBup/RiwOxxA8HA07kp2BuXLHNBAV2fYmVA//fEGf2zPRTsTrr+RbCwTmII DoYbqCRWAncJeqlMBEI8Y7Ohu96J X-Received: by 2002:a2e:bc17:0:b0:385:bf10:11fd with SMTP id 38308e7fff4ca-385da11dd25mr6860291fa.43.1769162379515; Fri, 23 Jan 2026 01:59:39 -0800 (PST) Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Fri, 23 Jan 2026 03:59:38 -0600 Received: from 1064022179695 named unknown by gmailapi.google.com with HTTPREST; Fri, 23 Jan 2026 03:59:35 -0600 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 (Mimestream 1.9.7) References: In-Reply-To: Date: Fri, 23 Jan 2026 03:59:38 -0600 X-Gm-Features: AZwV_Qi7lmrp0thC7kbzGEAYMayLejjE5PgX98XhxNT4N62pPeoHKEeztdKiTYU Message-ID: Subject: Re: [PHP-DEV] [VOTE] let construct (Block Scoping) To: Arnaud Le Blanc Cc: php internals , Seifeddine Gmati , =?UTF-8?Q?Tim_D=C3=BCsterhus?= Content-Type: multipart/alternative; boundary="0000000000002e677a06490b377e" From: kontakt@beberlei.de (=?UTF-8?Q?Benjamin_Au=C3=9Fenhofer?=) --0000000000002e677a06490b377e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Am 22.01.2026, 18:57:04 schrieb 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. > I agree that relying on reference counting can bite you, but I still voted Yes, because - We only have reference counting to rely on in PHP as far as memory goes, and thats what people writing cleanup critical code rely on alread= y. This gives a much nicer syntax. - The future scope lists improvements as next steps, like the error when RC > 1 or Disposable interfaces, this is a first step towards something that is missing dearly. > 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 > --0000000000002e677a06490b377e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Am 22.01.2026, 18:57:04 schrieb A= rnaud Le Blanc <arnaud.lb@gmail.c= om>:
=20
On Thu, Jan 22, 2026 at 10:17=E2=80=AFAM Tim D=C3=BCsterhus <tim@bastelstu.be> wrote:

Hi

we= just opened the vote on the =E2=80=9Clet construct (Block Scoping)=E2=80= =9D RFC
(which was originally pr= oposed as =E2=80=9Cuse construct=E2=80=9D, but the keyword
=
changed as a result of the discussion).

Hi,

Thank you for your work on this.

I voted no b= ecause the RFC is presented as a way to dispose of
resources immediately= (quoting: "This feature provides immense value,
particularly for m= odern applications built on long-lived servers,
where disciplined and im= mediate resource cleanup is not just a best
practice, but a necessity fo= r stability and performance."), yet it
doesn't in practice as i= t relies on reference counting as a proxy for
cleaning up at block exit.=

I agree that relying on reference counting ca= n bite you, but I still voted Yes, because
=
  • We only have reference counting to rely on in PHP as far as = memory goes, and thats what people writing cleanup critical code rely on al= ready. This gives a much nicer syntax.
  • The future scope lists i= mprovements as next steps, like the error when RC > 1 or Disposable inte= rfaces, this is a first step towards something that is missing dearly.
  • =


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 s= end
the resource to other functions or 3rd party code that may retain a<= br>reference to it. Moreover, there are many non-obvious ways in which areference count can be increased or a value=E2=80=99s lifetime extended:exceptions or backtraces may capture arguments, fibers, generators, orclosures with non obvious lifetimes retain their local variables,
closu= res tend to create cycles, foreach variables are not always
unset, etc.<= br>
Therefore there is a non-zero possibility that a let() statement wil= l
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.

T= he RFC refers to similar constructs from other languages, but none of
th= em rely on reference counting for this purpose. I'm not aware of
lan= guages relying on reference counting for this.

Best Regards,
Arna= ud
--0000000000002e677a06490b377e--