Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127157 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 qa.php.net (Postfix) with ESMTPS id DB5B01A00CE for ; Sun, 20 Apr 2025 13:43:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1745156485; bh=Bq37QvD7LRkBgNjn4T8TaqTrAV3DElB5f+JektmxE0I=; h=Date:From:To:In-Reply-To:References:Subject:From; b=eLogtKzL77ySOKUHEYCshBDJRBOyUitGKm+LW1nq/SVsZNI/a/zr/zRHvwrzcFAWp 2BcXrGfyYR9nGKtutxDz2mlXn3LIKjzhQMgWoml0hw2CAX6zyxAKW2jVHs3a1BFifG GnNJDX1zQsAJm+m+JT8yn+TB75c+S49IgC5orTCWNjcQ2nlrTnZaUB71dslQZivKsa zB/6WZbpcLCSUw2R/oR6snQ4pezCCT1jLY+ESPfuk5k15Tx9xqG+Bg96kIvCVOGMWm CIFf6jkmdYPM6lQAvPHxsDh4UoNehIlVeeTVLM6N7/O+hczqMhNC5yzs4hmnQFWoNY cD/A1LIoUDE2w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2160318007E for ; Sun, 20 Apr 2025 13:41:24 +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.8 required=5.0 tests=BAYES_00,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.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (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, 20 Apr 2025 13:41:23 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfhigh.stl.internal (Postfix) with ESMTP id 9B6BA25401F3 for ; Sun, 20 Apr 2025 09:43:43 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-05.internal (MEProxy); Sun, 20 Apr 2025 09:43:43 -0400 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=fm3; t=1745156623; x=1745243023; bh=9qTOmdPj0t BYn3ocRKVX8KjwOzKcy1rz3Rz2S9FhlWk=; b=grqGVMnoG0lpbpBMsX8b+mTHD9 35QkPnMbbvoznDkgWZELm32Qpzha5xnaGzUUx2Fou8KuTLrwc0+e/yXq420uOy/A GTT/mJvCisoWD5TZylJHdD7tPfWUc2dHcmIu6rTwrZWWafc33wizluX1n8nrWgof JgGK5RqldmGqXZ/h9GVPhb8FiOOGqD35fIrjGu4Iy5z3wSDanOXoXcUzdWXgk40Q T4yfCd5USSrGSGtN09AIoX25ixCWf5nqSGwybq42Zd4RHRWKCuRMZYuUZtgHNQVQ 6ZEa59E7wQHfgZpxSgChFMQiGMK+VhjgsaS++oJsbtZ5PBJf5yUkFLKUmwAg== 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=fm2; t= 1745156623; x=1745243023; bh=9qTOmdPj0tBYn3ocRKVX8KjwOzKcy1rz3Rz 2S9FhlWk=; b=R69+0vm9CKlH/D7bW6wyxt/Sv4vxiT3dk3OW1mZ7jFZ6Lhof/Nc aPXG2BWiwIbFajZ6IxpykwkywPhMKvpoNWDvX5HS5hHd6qFDc+R7TOo/0Au3U67i rM8OWQpNio0Ye/Q9H6jVAHtCYLAWWGktZNR6Wkw0KNDRPs/gQx3UeIUAKQb+mypk AwE64QTHeFYqxxtmtBteKHyXdahk8/ujOGg30E9q+K9IKXYEtvawAGFcfVa5bv+e 0ymu02jVknhZEcNic1XGnqYUxiKSq6f7RwtUF1KCGoZRXMNa+bB99fA1cwG6L/rJ zTXZanKJx2thQi9eQK1iz7bexezhoqKcz+A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvfeektdekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefogg ffhffvkfgjfhfutgesrgdtreerredtjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhs fdcuoehrohgssegsohhtthhlvggurdgtohguvghsqeenucggtffrrghtthgvrhhnpedtue ejtdethfeulefhtdelieduteelffdtudelheffgedtieehhfelieejgfevgeenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgssegsohhtth hlvggurdgtohguvghspdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdp rhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 08ACF780069; Sun, 20 Apr 2025 09:43:43 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: T7acb3853146d671b Date: Sun, 20 Apr 2025 15:43:10 +0200 To: internals@lists.php.net Message-ID: <03a5b9a8-9fe1-4656-ab04-dd58669488b3@app.fastmail.com> In-Reply-To: <706e22d7-94eb-44bd-a280-f629ba93b630@app.fastmail.com> References: <3e4ba7ea-a154-452d-abfc-05ef1322fade@app.fastmail.com> <782d76d9-711a-4cee-ae0e-fe0d69973f53@app.fastmail.com> <48dce917-d147-456b-9f03-c7e23411adff@app.fastmail.com> <8a16b81c-7dab-4523-a352-76ba0cb4e771@app.fastmail.com> <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> Subject: [PHP-DEV] Re: RFC: Nested Classes (was: short and inner classes) Content-Type: multipart/alternative; boundary=ed130f45aa0d40d2bce5bb1735978028 From: rob@bottled.codes ("Rob Landers") --ed130f45aa0d40d2bce5bb1735978028 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Mar 31, 2025, at 21:45, Rob Landers wrote: > Hello internals, >=20 > I have significantly revamped the RFC (again). Key changes to the RFC: >=20 > 1. More (realistic) examples, > 2. Since enums are basically specialized classes, they are allowed to = be nested as well (hat tip to Reddit), > 3. Using backslash as the class separator, > 4. Proper scoping (and shadowing), > 5. Nesting is allowed in interfaces and enums as well as classes; but = not traits, > 6. (Hopefully) Clearer wording, > 7. Nesting in traits, or nested traits, are future scope, > 8. Nested interfaces are future scope too. >=20 > Some benefits of using \ as a separator: >=20 > - a simple name can refer to nested classes: >=20 > Scope resolution was expanded to treat inner classes within the same c= lass as =E2=80=9Cin scope.=E2=80=9D This provides a more natural usage: >=20 > class Outer { > class Inner {} > public function foo(Inner $inner) {} > } >=20 > - Standard =E2=80=9Cuse=E2=80=9D statements can alias them: >=20 > use Outer\Inner as Inner; >=20 > But it also has some draw backs: >=20 > - The engine doesn=E2=80=99t know that Outer\Inner is a nested class a= nd autoloaders will have to account for that. It will only ask for Outer= \Inner. >=20 > - You cannot simply refer to parent:>Inner, you have to explicitly ask= for the parent by name: SomeParentClass\Inner.=20 >=20 > A draft implementation (which is more of a proof-of-concept) is availa= ble on GitHub. Hello internals, As it seems that discussion has mostly died down, I'd like to put this t= owards a vote starting on May 1, 2025. =E2=80=94 Rob --ed130f45aa0d40d2bce5bb1735978028 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable