Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130207 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 B2DD61A00BC for ; Sun, 1 Mar 2026 12:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1772368565; bh=4HnlqowhcgWc9ZfpdWVh9uQozOmHRw6FLWYE2ZritnU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CKi2od8Zhdh6w+sLB9yIayr4u5UtlUt8eoocBhuiUoOPiE0PKpchY/8jalV9bbVKx 8zDetv728ATTGdr5YEXU3jC3VrlLurPbnR/zCS/AJ8DQCz0TwBaP2Lxj/gIh/xJZsr vYbhgV+YH/FtU7qWY/xULrW9rAfO7A4DjBK1Rq8zWJbEZjDbvOwzgqUfCtTKeZYr0U CAX8j1/hfsmRaXZ9Xut/gpP8vrsOFLaycCP+Qi//LQjRj61JEwrBLdu5vt/s/GALKj G11wc80FqyaQ5cCprrCVV5MvoaAhYUPEnmpJLyD9/0j1RNXbJUAlMqKlZixhgdG5dp 4hE30KoZm3tWQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id ABAC8180069 for ; Sun, 1 Mar 2026 12:36:04 +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 ; Sun, 1 Mar 2026 12:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1772368557; bh=wRsK61dHW/tLrXi1m1qPpTpGriQaSzDFiO4RSbKmdu8=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=eDvocbe6DfeHOC+noVIFBossFn/3bzZADIOQaKjObB2TPKGN+2WwiXIF8e1XDwqAG nmWr6L82zOXebjbr0S+bCptjO8qpz8HzCUa4sbLowTgtydbUJyX0vETsiG9Nl7rrFT SWJwi0mAj5h1MqF1f/dPv+nL9TAygHtxJCWiA+I6RpNGorCF3gtc8afS5S+uxPFxmZ +8IW0tMhnRSrPv+65M1dy/+iuYfatYgUk5uu1ESkQBQngUNT2w0pfQp7GccHS7gzNL 7D1Xzzr+HL0i0AlbliALR0Bgkn81UfvlxCveYRo9Nxn1/iWgEm7SdnJT2aegPaoMrO dwOONJUpq02zQ== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Sun, 01 Mar 2026 13:35:57 +0100 To: Ilija Tovilo Cc: PHP internals Subject: Re: [PHP-DEV] Re: [RFC] Readonly Variables In-Reply-To: References: 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-02-25 15:41, schrieb Ilija Tovilo: > - Without runtime tracking of readonly (and the concept of block > scoping) every variable name could only be declared once in a function. After thinking about the RFC for a few days, Ilija is making a good point here: I find “block scoping” a necessary prerequisite to have local readonly variables (and also local typed variables). Being able to define a readonly variable within an `if()` and thus making it *conditionally* readonly (or conditionally typed) is going to invite confusion. It is the obviously correct behavior with the current semantics of PHP, though. I nevertheless appreciate the effort that went into the RFC, particular with the attention to detail pointing out all “edge cases”. It made it really easy to think about the proposal, because there was no need to make assumptions about how it's supposed to work. Best regards Tim Düsterhus