Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129417 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 68D4B1A00BC for ; Sun, 23 Nov 2025 19:26:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1763925977; bh=aui6bfFnxvaefLlte+a7eg/1cRt5pgZLB1rwpJfU9OU=; h=Date:From:To:In-Reply-To:References:Subject:From; b=VKjcn99S1otxxcFbU8MmDIQzeT6RaNWKA0gU61ZGTMJalbEsvQWABkS4d0PXt95RP /1B4FcZBFZtRZzrDOk/Id/Vt5As0XRbeU19QVub63ZAb1qHjEAVmZ3ge+nErGO5kao FJZqH6k5ZJ2gyUcdVMrVELjIn1UGMJGujswHY5aVnZmgZzvs190iv5JVX+jrqhvJzR 2hrfjx0KYXl1VqmS5fmG17m9ai38SL+Z5pmDaJXkTMHb8ZtH9FRNZNZoK6YMDEqdYG UdTw1avn6WwyRbDpd8C7xqmhoF7ozWVEXY5sNFOPcusC9jX/Vf2bCBa2k6zddr2opo +L4v6e1WKar/A== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A336C18002E for ; Sun, 23 Nov 2025 19:26:13 +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=BAYES_40,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fout-b6-smtp.messagingengine.com (fout-b6-smtp.messagingengine.com [202.12.124.149]) (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, 23 Nov 2025 19:26:13 +0000 (UTC) Received: from phl-compute-12.internal (phl-compute-12.internal [10.202.2.52]) by mailfout.stl.internal (Postfix) with ESMTP id 36AE51D000C7; Sun, 23 Nov 2025 14:26:07 -0500 (EST) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-12.internal (MEProxy); Sun, 23 Nov 2025 14:26:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1763925967; x=1764012367; bh=aui6bfFnxv aefLlte+a7eg/1cRt5pgZLB1rwpJfU9OU=; b=R6XNK+5DaQihOdw0RKb2GoBV/N NMTZdQeBvVtBryASMcTslYWjsng3RZQOelnYYZCjZRwCIniCRJRR7SiVHu63q7FT sNiWw95XXWBvdSZJWwdoXqedctb6HgeUpyFpwcSZ81ldVf5nFxS+GAcjBCzUBLa3 PG6tfLxJKnM6ffOWQBHyvZYthPQ2nVjcBLK0U+wpl6XflyXl+pKa8foeW8lhLbU5 kcnofksI4ZCX1Rd/PSyRa76VXJln561MKDKEu2jMGxjHEyRnqSH4jMAu6MrIWvU7 64+Nz7uI6Qh76ln+bPuWzh5QdXYVncQxlbpLr60UwgRmfaJaQ7IKqgHEjVXw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1763925967; x=1764012367; bh=aui6bfFnxvaefLlte+a7eg/1cRt5pgZLB1r wpJfU9OU=; b=ccm8KFpN2aebFqA/LW9ZsLEdURnbXxscvi+ueZ5fZFNfwEJdsjC VX8EexsndWZqjUy+ivR3SNCQH0EMscmOdBICX82CCxRxpejqXqcvc9nkQ/DVfkhK IRSklUP/tnY2dNMhhadfcjcj5d3RzMwuVbIzFup/w1/5MJ4ax9BiVZGDlrcDXKSs /V7tqsJK94oVLsQWJconxWRkLXiYuB73xiOyX1I9ANteuZKUIzXM3AwQy6eKiUJ1 ECQ/K0tHP+G7kuLQD//QOh2kEchRULEJqxcu86cBV/65cHRINAk3B1oisVvzk2/w 9/Nfyd2qYAIrYy3QTQ6dEgKHDRxJUQz9/ww== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvfeeiheehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefoggffhffvkfgjfhfutgesrgdtreerre dtjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhsfdcuoehrohgssegsohhtthhlvggu rdgtohguvghsqeenucggtffrrghtthgvrhhnpefgtdegkedvveduffeigfelteehheejud eigfeludefveeiffefgffgleelvedtfeenucffohhmrghinhepphhhphdrnhgvthdptghh rghtghhpthdrtghomhdpghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothhtlhgvugdrtghouggvshdp nhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepthhimh essggrshhtvghlshhtuhdrsggvpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishht shdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 54C3B1820054; Sun, 23 Nov 2025 14:26:06 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: AZgO4gJIj6HZ Date: Sun, 23 Nov 2025 20:25:29 +0100 To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= , internals@lists.php.net Message-ID: <7a9286a9-17c8-44fb-8d10-3483aaf8bc6d@app.fastmail.com> In-Reply-To: References: <72f90052-fa19-415c-9f5a-ae75275fd030@rwec.co.uk> <2d9f8f1d-e568-4bb5-b30c-0a9e54a8f5fe@rwec.co.uk> <8978174c-04fc-451a-8bf5-cb7c54346318@app.fastmail.com> <1606b9e5-62b8-446b-adac-519ac19d01c3@app.fastmail.com> Subject: Re: [PHP-DEV] RFC: Namespace-Scoped Visibility for Methods and Properties Content-Type: multipart/alternative; boundary=46e9984d1ba84ca0b4eaf45498cfabb4 From: rob@bottled.codes ("Rob Landers") --46e9984d1ba84ca0b4eaf45498cfabb4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun, Nov 23, 2025, at 17:00, Tim D=C3=BCsterhus wrote: > Hi >=20 > On 11/10/25 20:19, Rob Landers wrote: > > Updated RFC: > > https://wiki.php.net/rfc/namespace_visibility >=20 > From the RFC I'm seeing that it's legal to redefine methods in=20 > different namespaces? I've only figured that out with the last example=20 > in the =E2=80=9CPreventing Visibility Reduction and Incompatible Redec= laration=E2=80=9D=20 > section, it might have been hinted at with =E2=80=9CHowever, visibilit= y is=20 > enforced based on the namespace where they were declared, not on the=20 > inheritance hierarchy:=E2=80=9D but if it did, I didn't understand it. No, it should be illegal, but it looks like the current RFC text doesn=E2= =80=99t say that. Basically, private(namespace) is incompatible with pri= vate(namespace) if the original namespace doesn=E2=80=99t match the curr= ent namespace. I=E2=80=99ll update the RFC later this week. > I feel that namespace-scoping needs to be restricted to top-level=20 > symbols to be easy to reason about. This also brings me to the next=20 > point: What about free-standing functions and constants?=20 > public/protected/private doesn't make sense for them, since they are n= ot=20 > part of a inheritance hierarchy. But namespace-scope would be meaningf= ul. That would need https://github.com/php/php-src/pull/20490 (subtle wink e= moji) >=20 > All in all, I feel that file-private symbols would solve many of the=20 > same problems, but be much easier to reason about. The SessionManager=20 > from your example could just be file-private. You can use private(namespace) as effectively file-private, just use a n= amespace in a single file. And, if you need to refactor, you don=E2=80=99= t need to be constrained to a single file. =E2=80=94 Rob --46e9984d1ba84ca0b4eaf45498cfabb4 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Sun, Nov 23, 2025, at 17:00, Tim D=C3=BCsterhus wro= te:
Hi

On 11/10/25 20:19, Rob Landers wrote:
> Up= dated RFC:
https://wiki.php.net/rfc/namespace_visibility <<= a href=3D"https://wiki.php.net/rfc/namespace_visibility?utm_source=3Dcha= tgpt.com">https://wiki.php.net/rfc/namespace_visibility?utm_source=3Dcha= tgpt.com>

From the RFC I'm seeing that i= t's legal to redefine methods in 
different namespaces? I= 've only figured that out with the last example 
in the =E2= =80=9CPreventing Visibility Reduction and Incompatible Redeclaration=E2=80= =9D 
section, it might have been hinted at with =E2=80=9C= However, visibility is 
enforced based on the namespace w= here they were declared, not on the 
inheritance hierarch= y:=E2=80=9D but if it did, I didn't understand it.

No, it should be illegal, but it looks like the current= RFC text doesn=E2=80=99t say that. Basically, private(namespace) is inc= ompatible with private(namespace) if the original namespace doesn=E2=80=99= t match the current namespace. I=E2=80=99ll update the RFC later this we= ek.

I feel that namespace-scoping needs to be restricted to top-leve= l 
symbols to be easy to reason about. This also brings m= e to the next 
point: What about free-standing functions = and constants? 
public/protected/private doesn't make sen= se for them, since they are not 
part of a inheritance hi= erarchy. But namespace-scope would be meaningful.

That would need https://github.com/php/php-src/pull/20490 (s= ubtle wink emoji)


All in all, I feel that file-private sy= mbols would solve many of the 
same problems, but be much= easier to reason about. The SessionManager 
from your ex= ample could just be file-private.

= You can use private(namespace) as effectively file-private, just use a n= amespace in a single file. And, if you need to refactor, you don=E2=80=99= t need to be constrained to a single file.

=E2=80=94 Rob
--46e9984d1ba84ca0b4eaf45498cfabb4--