Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127250 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 774F11A00BC for ; Wed, 30 Apr 2025 10:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746010184; bh=DDzuPH6MfUTw6MgAQ5FXPPueQJfnBoJI0xkSDTg4Jfg=; h=Date:From:To:Subject:In-Reply-To:References:From; b=TfhvCGHEgrUW3USdNfW81D09GCSg9bgREh7V3wqpzJ3g1g4ijr7k86Z3skA1L/7ma wdA11r3Jzx9JNtd5pHlZlJNM/Q/WbbDinro36tjuiMYiqypxv+SI/nC3Rd2a1XkUgU KwOTOlUvSElxAjjohb/Qc9ZZIiV2/njYZaFeP5SZVQFg0mqDfRvPkdRp5Rf9zyHOun C8ieCutnjNWyXUcOr0C9yKlXbOCBNDqCQu/zPWhtxAVcH9K2XlYc9oGwvM3xJZK7yd NeRWQ9sl/Eoq5BPZ0PsxNrpr7xWUpJnnUru60HsqTA+Iw9vqIRD+gEnyiRxnguTD38 cF8tWVJuNgd0w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 55AE3180055 for ; Wed, 30 Apr 2025 10:49:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_20,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.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fhigh-a4-smtp.messagingengine.com (fhigh-a4-smtp.messagingengine.com [103.168.172.155]) (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 ; Wed, 30 Apr 2025 10:49:42 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.phl.internal (Postfix) with ESMTP id 7CDF311400EA for ; Wed, 30 Apr 2025 06:51:58 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-11.internal (MEProxy); Wed, 30 Apr 2025 06:51:58 -0400 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=1746010318; x=1746096718; bh=DDzuPH6MfUTw6MgAQ5FXPPueQJfnBoJI0xkSDTg4Jfg=; b= Vo+0J8IiUGp6NePRCrbAZPKuR2bucN0Ds7YxhMuAzQhUZXofwDNS6CllEunVuZEL Y6wZC+SjYPTqMOe/H7IwPbG51v69dmO/xWHAtvHGiE4lauezsCIM17sYesZJpbYp KEuflhZtVOLgAzB7lsbwkDs21+2953zfYzyC3+RIWsZwZPOsdNp2Zj90XlTrgIfD wEYWl27G7aDAjTjrdv63ceGYBiQHjavZe8K0do8mkl/J3b/U5U9SJ/HYdXb/vO1S V5CoaWpOMYv7/WKjP+zNTVkXSpdTJx8Kl/wAWqxG3lXxGaxNjMF21g7r1ysGZ96F Z7FTIXHhYa2dunwKIYZN4w== 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=1746010318; x=1746096718; bh=D DzuPH6MfUTw6MgAQ5FXPPueQJfnBoJI0xkSDTg4Jfg=; b=SCcfKspBjWF4Vr0LS nnSXoLAXO3u/UOIYkJ7BAxVW5U2yxLp0cAC9vGRjBDTDkf9eyBB2rbUNZBNUFgoi SiDllJXikd3hwznsvm9vz15MAPuMhS2/H2HBEQmh0Y/s9MMYf8O2Y7i+oFMSvY13 p+yeswGvCdxxH5US0+diX8Vg3PJ+tOrdJZRE6kEmEiVc9paUADWZmmMnTFvc++aW 0zdgt8DMO0Qhhy88IQnzTMCvXEJ/Nug7BeHMklKYOiCx5MNW6uC/B7EeE16diOEH FRVvJaOo177XuAmMjk/KhIfdXdF8MEjrg+sCalBy+UE/qhCObBDssKAkvzA1G4lM FJMFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvieeihedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpeffhf fvufgfjghfkfggtgfgsehtqhhmtddtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhm ihhnshculgfkoffuohfrngdfuceoihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqe enucggtffrrghtthgvrhhnpeehleffteeigfevudetfedugedtudevledugeeugeelheei hfehgfdtkeevvefgleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslh hishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Wed, 30 Apr 2025 06:51:57 -0400 (EDT) Date: Wed, 30 Apr 2025 11:51:55 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] Re: RFC: Nested Classes User-Agent: K-9 Mail for Android In-Reply-To: <213a8711-adbc-42b7-bcb8-86e64cb22cf2@bastelstu.be> References: <9c4ac301-dfb2-49da-90e5-37a2824fc4e3@app.fastmail.com> <5b1e6d70-a1c9-455c-93d3-6b22cf1fef11@app.fastmail.com> <52d84a5b-09d3-4e42-9620-a62fb239c21e@app.fastmail.com> <09a82882-f1ee-4bdb-8a27-e46144a711f1@app.fastmail.com> <706e22d7-94eb-44bd-a280-f629ba93b630@app.fastmail.com> <03a5b9a8-9fe1-4656-ab04-dd58669488b3@app.fastmail.com> <158a5d7c-8ef6-4b5f-b8ef-593879a7a896@bastelstu.be> <72ef8352-2afb-4024-b4ae-857fcd94edd6@app.fastmail.com> <213a8711-adbc-42b7-bcb8-86e64cb22cf2@bastelstu.be> Message-ID: <5A723310-1AB6-4D4A-88CC-52EC4E81AE5C@rwec.co.uk> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 29 April 2025 19:50:52 BST, "Tim D=C3=BCsterhus" w= rote: >I'm saying that I cannot add a private class Foo\Bar inside of the class = Foo without checking whether a class Bar inside a namespace Foo already exi= sts, since both would conflict=2E Even more problematic: I can't add a clas= s Bar inside of namespace Foo, without needing to check the source code of = class Foo to determine whether there is a private class Bar that I have no = business of knowing that it exists=2E I think you are insisting on a different definition of "private" for neste= d classes than exists anywhere else in the language, and one that I've not = seen evidence of in any other similar language either=2E It seems you want = members to be "hidden", such that you can't even know they exist=2E=20 More specifically, you want their *fully-qualified name* to somehow be ava= ilable for reuse=2E That's not how private members of a class work - method= s A::foo() and B::foo() have different fully-qualified names, as do propert= ies A::$foo and B::$foo, regardless of visibility and inheritance=2E It's n= ot how "namespace private", "module private", or "file private" classes wou= ld naturally work, because they all would need to be referenceable with ful= ly-qualified names within the scope where they were visible=2E=20 It's also not a new problem: PHP doesn't enforce a file and directory layo= ut, and libraries can and do define things "inside" each other's namespaces= =2E When declaring a class, you have to be aware of whether a class with th= e same fully-qualified name has been, or will be, declared in another file= =2E There is a challenge in any feature that encourages multiple definitions i= n one file, that new conventions are needed to know at a glance when that i= s in use, because we have become accustomed to the (Java-inspired?) one-cla= ss-per-file convention=2E That's not about *hiding* things, though, because= those multiple definitions might be public; nor is it unique to this propo= sal - it comes up with function autoloading, typedefs, and many more=2E >And when I'm forced to always verify whether my private classes conflict = with something, then nested classes do not provide a measurable value-add o= ver a =E2=80=9Cregular class=E2=80=9D in a namespace matching the parent cl= ass' class name that is marked `@internal`=2E The value-add is 1) that they enforce the visibility at the language level= , and 2) that they allow a concise syntax for declaring a set of closely re= lated classes=2E I'm not wholly convinced that they do that better than "file private" or "= module private", but I don't agree that "class hiding" is essential, or eve= n particularly desirable=2E Rowan Tommins [IMSoP]