Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127299 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 CA3071A00BC for ; Wed, 7 May 2025 13:10:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746623308; bh=LObsDxble3y6AoX88r2ochU5X8FCFHfr4w1Wfyz2aWQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DRGhAl7Nk9d53w+EUGlbTkGk5yTt4fPyb1c9S9nDzje8SizPKcw8m7XwlWf/NlC8d Lsvf2bU6R3tRvHlAG5xgY2A1O0pi2yh2FmQLKwxpc8V7YIseTP5n0FR7sj7WGNDbQS b5hArr32nw9VYI6AqTpF3jU0xiaN7Cz1t42mXzdX9/fXufw2I8dx6f15GoipHeo6hf jGenhHUe6FDOUH8ynelYisgdrtWSUD5psPEIj2k3I/dAzcqPp0NdTA1Kp/u5unv24H HN8fZxUJYbrb8fI1xhajVqfTQN41BRFEYr8/T50Kt+mFVf4rJ9xmz708Drz0E3Tqll YjXk22upgxY4w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C6169180088 for ; Wed, 7 May 2025 13:08:27 +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=-2.1 required=5.0 tests=BAYES_00,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.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) 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 ; Wed, 7 May 2025 13:08:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1746623428; bh=aadfg8vJBghybyD+ssyW+yR1lXFm38i5X83thRpGmbY=; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=AxAEPZZqHATm6h+1oOs3OrIwbFhZtBgJdRgHWFZhm/JFbeRUl1CUp1f5f+hHCdkm/ zWsjKjoahvCDwFjSesZknS/u5tQkNXovR5Czq2vU35fGnV3Txw6z6WKFQIBO8mTY1u SwVrPL0Zz9XXH+H8kiArK03UdSpg9jjHa9gqpVXpoHSMEDAnnjQS//b5ypVn5akDU0 J9DHjZpmG5Ws52+A7y1AD5XHTYz41UfTJXDSVl8k4LCWNEgOYmXX/HfM0qIgT9byAZ 8J8XSyezpPq0pJk0xdl/MPX79p2+UAQTV+sTQsZFYbaCihqryd081CQq2Tmyvlslnm gcdX6rd6EcUjQ== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 07 May 2025 15:10:28 +0200 To: "Rowan Tommins [IMSoP]" Cc: internals@lists.php.net Subject: Re: [PHP-DEV] Re: RFC: Nested Classes In-Reply-To: <91B29E1C-EA9D-4BF0-8D69-42B43820F574@rwec.co.uk> 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> <5A723310-1AB6-4D4A-88CC-52EC4E81AE5C@rwec.co.uk> <681845d2-ff1e-4ab8-97b2-50fecfdcb62b@bastelstu.be> <91B29E1C-EA9D-4BF0-8D69-42B43820F574@rwec.co.uk> Message-ID: <4943d4f939e61a72b41f9edacbf8eeca@bastelstu.be> 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 2025-05-06 21:33, schrieb Rowan Tommins [IMSoP]: > The classes that you'll need to be aware of will exist whether this > feature is added or not, and you'll already need to avoid conflicting > with them - usually by simply avoiding the main namespace prefix of the > library. If this feature was designed like all the other implementations of `private`, I would not need to be aware of the other classes, since PHP would name-mangle the private symbol for me to ensure it doesn't conflict. In the simplest case it could compile class Foo { private class Bar { } } As: class Foo { } class Foo$Bar { } And rewrite all references inside of `Foo` to `Foo$Bar` (using Java's name mangling). This is effectively what Ilija's proposal for file-private classes did: https://externals.io/message/126331#126337. I think this would also be nicer on the autoloading impact. Since a private class is not usable outside of its container class, it doesn't make sense to attempt to autoload it individually, since to reference it, the container class must already be loaded (which means the private class is also already loaded). Best regards Tim Düsterhus