Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129158 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 405AC1A00BC for ; Sat, 8 Nov 2025 23:13:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762643615; bh=pMK1CK/9z0a0YvnKkxUawwmDeSBiA3M3TxSEo8ooZSw=; h=Date:Subject:To:References:From:In-Reply-To:From; b=WqSVEYBVLXcgW7l2TG+RWzkq8pHRXUsxDvS7SIBbTkfGc4rnsU5TzyJE+iT9KJLke gJ37C0nzNGGcHif6T+slx7SNi77mbXLvOm43PYXaUB+2KYEHjab3q/Ry+66UVC589j ZWNMXF0Zw6cCMFAzJ53Bb+Va9Q2Sqe/RCEVjcd5EzdddumCi0Naa/zDJbdPZ8A87WC Rxk3IpLJL7wS/X4wRPtytZmzEG6WFd7rAJciWwDR+vQPLktpyzsddKqD962QkO7Bhu UNcg7uqYSmTaKYhMzh8Nf7NEmVAsxbKrJWZbDRGahoP7IaKjKNqywYN6du1xTzftlX KJMLT8gyMnrwA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C8FD3180087 for ; Sat, 8 Nov 2025 23:13:34 +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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,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 fhigh-b3-smtp.messagingengine.com (fhigh-b3-smtp.messagingengine.com [202.12.124.154]) (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 ; Sat, 8 Nov 2025 23:13:24 +0000 (UTC) Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfhigh.stl.internal (Postfix) with ESMTP id 1496A7A0045 for ; Sat, 8 Nov 2025 18:13:19 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-03.internal (MEProxy); Sat, 08 Nov 2025 18:13:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; h=cc :content-transfer-encoding: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=fm3; t=1762643598; x=1762729998; bh=k99qVa7BuuwwN3ia/eSyLPdQmN5uOTJE0rqz2M3X4sI=; b= Bhm88QGAVRo1e/aQy/9lq1vBfuGyNPY3TFPtdxhPwXT+e87eRJTXVPSffMqHSEmc lPfcd6isLbcpb4oQIMVFTSJwAU4Mby/lcqBiKktJYWpdPbLUyqVRMeEcN5mS7/7l w4erHQs/maXTbfHyVseLAgadYUaFDcHvkjZ7+mn2ZZs22NhAvOuZ4aupEWkIKAf+ VRV3heTc5taah8wmO9msjMuuUWLtBryL6mOpeyHlCIrvctkiw51EkC431CdE0Q4K LXL5LK/Hr1BXsXZzEb+iwu3KEkYUeS3EBtrXyHVgQnD00xdrhuSkl5HVyVL7bk12 HwNePiE+yUTHlSEfR/Qs0w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=1762643598; x=1762729998; bh=k 99qVa7BuuwwN3ia/eSyLPdQmN5uOTJE0rqz2M3X4sI=; b=v7/dMBA1QoGcEftFT 1XrJpBFQ/cfayxN783GIWqGZA3klheVnSAO9g34H+6CltpNA1SXiXaWPO1dATARJ aOCkUhJR7W+gmjoyb0lpcs/oi4Zd6DP29EErV8WO+6S6/zoC5dH9xE0xL8+TwIDg NGFS1kMF2RaYEycBfkrCIlDjoQRwrxWr2GZC4bSagmxPQy9tTX6X3+q7/cBIwjUy UUoqiCTQp5wGDg5Xn0q1ymmT1XeZw2V836oeQ5Zi0AFCAlJ3sZeWAUkTYFs93usg Syp5ASeoD1izOfAvb7z2ofmW4FpHnORhRZXV9llPWfdPqbtdKYQY4xTVNyM0ZiX4 RNlwg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduleefkeefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtkeertd dtvdejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdfuceo ihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpeffke evudffuddvheejvdefkeelfedtudegfeehjeduheegieduffeggeegveefheenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprdhphh hpsehrfigvtgdrtghordhukhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 8 Nov 2025 18:13:18 -0500 (EST) Message-ID: <2d9f8f1d-e568-4bb5-b30c-0a9e54a8f5fe@rwec.co.uk> Date: Sat, 8 Nov 2025 23:13:17 +0000 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] RFC: Namespace-Scoped Visibility for Methods and Properties Content-Language: en-GB To: internals@lists.php.net References: <72f90052-fa19-415c-9f5a-ae75275fd030@rwec.co.uk> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 08/11/2025 21:56, Rob Landers wrote: > > Those approaches: prefix matching, wildcard matching, level-based > matching, or allow/deny lists are all significantly more expressive > than what this RFC is aiming for. Yes. That's why I think they're a better idea. > They move the discussion from "namespace -private visibility" into > designing a generalised access-control system or a de-facto package model. No. They explicitly *avoid* defining any kind of package model, by letting the user mention *whatever prefix they like*. That might match the root namespace they mention in composer.json, but it might just be a particular set of classes in a giant spaghetti application with no conception of "package" whatsoever. > The goal of this RFC is intentionally minimal: take the boundary that > already exists in the language (the lexical namespace) From the language's point of view, "namespace Foo\Bar; $x = new Baz;" is interchangeable with "namespace Foo; $x = new Bar\Baz;" Namespaces are inherently hierarchical, and *any* cut-off point in that hierarchy is an equally natural boundary. > Exact namespace equality keeps the rule unambiguous What is ambiguous about any of the examples I showed? > requires no new access-control model I have no idea what you mean by this. We don't currently have any namespace-based access-control, and we're addding it. How does "must match exactly" vs "must match given prefix" change that? > avoids assumptions about how developers structure hierarchies On the contrary, it assumes that a developer will structure their hierarchy so that related classes are in the same namespace, and not any parent or child namespaces. My suggestion, on the other hand, truly makes no assumption: it lets the developer specify exactly the structure they want. > One advantage of keeping this RFC small is that it can be expanded > later without a BC break. For example, prefix matching (maybe > something like `private(namespace: Acme\AuthLib)`) or a > protected-namespace variant could be layered on top if the community > wants to go in that direction. That's a reasonable argument, but the risk is that if we don't consider what that future scope would look like, we can end up with syntax or semantics that makes our lives unnecessarily difficult later. As I understand it, this happened to some extent with the "readonly" keyword. > This RFC isn’t intended to solve the entire space; it’s the smallest > useful step that seems to fairly cleanly fit into PHP’s current model > without too much churn on the engine. I think my fundamental question is: is it actually that useful? How often, in practice, do people want exact namespace matching, vs something more flexible? -- Rowan Tommins [IMSoP]