Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126915 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 ABF431A00BC for <internals@lists.php.net>; Sun, 23 Mar 2025 15:17:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742742926; bh=tWUX3TpCU7PbVxjiSS+1D/m+jDSdow407ksiqsRSTw0=; h=Date:From:To:In-Reply-To:References:Subject:From; b=hshaqWjiYSirEBhZxK5EG3PtvcyaOULN2yCn2Um8Kzq5LcJeBdTPgY8aXMX/awwRP oPNRX77A92QC3co0MDdpcMC9AGgsKzHkfG8alVGwI6TzJ7du9T2orG8KsZzijKCBHM si/Qh0miUnJavXdG9EzK72Z5bwlkdvY9qPgZI58ZRdVCBFYNVOPC9OskVAJW6S+I6z Gdvsn38BiIzya/Ss79jTIZHEpJ8mfZZZY/3D4M1zJeBEJAT6Cqx+ReyoZu/wwMGki1 LRW8oC2V7QDDz7BiSmlIPk05vO5z2D4nWqm0H7UfWHWsJA+VSVvqFzUNlajKKuVxuF U8QNKKyp6QNOw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 33D61180567 for <internals@lists.php.net>; Sun, 23 Mar 2025 15:15: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=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: <larry@garfieldtech.com> Received: from fhigh-a7-smtp.messagingengine.com (fhigh-a7-smtp.messagingengine.com [103.168.172.158]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for <internals@lists.php.net>; Sun, 23 Mar 2025 15:15:22 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id BBFFB1140151 for <internals@lists.php.net>; Sun, 23 Mar 2025 11:17:51 -0400 (EDT) Received: from phl-imap-06 ([10.202.2.83]) by phl-compute-04.internal (MEProxy); Sun, 23 Mar 2025 11:17:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; 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=fm1; t=1742743071; x=1742829471; bh=f61vTuwH/DHTq6lH+tDPL oP+vZDR9WZHcY3qyXLIFvs=; b=Vq1Qn0UNd7ZT9ZE57577EATO56jXys/sfJmts 5lJSR8DF7YGGHQLU17pDgOjDgbjkVgGoUa7awozo0cReJ19vW+Rwbmt4+QUG68Yq YwfnwWTPYRbZ7T5mQEvvds+6nvS+dKkGkoenW2LAB7ioYiSmCYoaSvMYwgSC2crI 6w1YlgjLYClQWun8qC9sA4omM/mjH8C4cc6TxdR25e0wYeoeGInElHFlHIFfLk3C b76oXMirVRn1PuHuJOPat9eFuaCG24Pa3CMZfjpGaleNeGWFjwWCS6dpjqsC0pqW 5yXLCopftOIeBCCX1lxMBfewGViOekqx/vhpffdBdrzhOtxqg== 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=fm1; t=1742743071; x=1742829471; bh=f 61vTuwH/DHTq6lH+tDPLoP+vZDR9WZHcY3qyXLIFvs=; b=EZTyO04L9YguFOO0p zKu0zcEUQzVS9nNtW/dXtpl3KUciHF1eZQvSqo3wHfHEQz5JpLnvxG/gpzfONd+B uWNlaMBx6V7MSQ06Hhld8SIyg9L2eC7G6oXPAxaNFeuVzuJ+osmKl7r9wUUWezur zHXZJK6aK8HV6Zahf8tyTrCUchk4pjwVeC3CypenqbmKOxQFAJN01tOjFLF5mm0q tHLRz11amjr7l7Wvy85SPh4hGAxygnIvQ+Uwpco8NQ8g+ZrwZGEGqmVkEz7eYwj7 pEZnPtqeDqW+RulSvuhKnTYez1TxunePi+K/O00d0FsE4uAvTUAsSJ/l//wNZuLD dzJMg== X-ME-Sender: <xms:HybgZ4WnHljOmZmIczjttSDDzGzk33JLY15JLzzE7sJuQidzsCd2rA> <xme:HybgZ8ntIBwHIscD6EIhdtgEk8E1pX0HlcTwJG8aRTmTNJPeCpeccK4u7HCgr7Fk1 3i1IsZ19UTiaA> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduheejvdduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtgfesthhqredtredt jeenucfhrhhomhepfdfnrghrrhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrh hfihgvlhguthgvtghhrdgtohhmqeenucggtffrrghtthgvrhhnpeffieeivdfhvdeguddt tdegteeiueegvefhteehfeeffeetudeitdehtdegjeeuieenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghlught vggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtg hpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: <xmx:HybgZ8YsVAr-4HV6iaFZNRSKYumLpphQ0uAlOGaQhFMoxxD7e83Z2A> <xmx:HybgZ3VgfEVTVCr-uo57qaYsl_IL6CSA0-ZQPZpEonsCJvwjn1Mk5g> <xmx:HybgZyn0vfK5i-UhamxJhxihg323V8uC2flqEu4Mhu-qNzkyQHpsvQ> <xmx:HybgZ8dn8Ci0JNBZmIb5NX1HkcF8NHuqDN2g5Qptwn0-mEt7r9SmXg> <xmx:HybgZ8Swv7iQBZUhRtMbB71owC66H6YNtqCeER1KI6jThrg9SeEQy-3q> Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 8CFDA29C006F; Sun, 23 Mar 2025 11:17:51 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: <mailto:internals+help@lists.php.net list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net> list-post: <mailto:internals@lists.php.net> List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: Td94a63d0143dd548 Date: Sun, 23 Mar 2025 10:17:30 -0500 To: "php internals" <internals@lists.php.net> Message-ID: <0db0cce1-c2da-4298-a7a0-c9c9c82ab498@app.fastmail.com> In-Reply-To: <2935d0e2-ddc4-447c-ab37-c9b7337b8b60@app.fastmail.com> References: <aae32397-0567-417f-adbe-6b663d5c49ae@app.fastmail.com> <2935d0e2-ddc4-447c-ab37-c9b7337b8b60@app.fastmail.com> Subject: Re: [PHP-DEV] Re: RFC: short and inner classes Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Wed, Mar 12, 2025, at 5:10 AM, Rob Landers wrote: > Hello internals, > > I've made some major updates to the text of the RFC to clarify=20 > behaviors and revisited the implementation (which is still under=20 > development, though I hope to have a draft by the end of this weekend)= .=20 > Here's a broad overview of what has changed in inner classes: > > - Accessing inner classes is done via a new token: ":>" instead of "::= ". > - Inner classes may now be infinitely nested. > - Inner classes may be declared `abstract`. > - Documented changes to ReflectionClass. > - Usage of `static` to refer to inner classes is restricted to prevent=20 > accidental violations of LSP. > > Otherwise, there are not any big changes, but a lot of time was spent=20 > clarifying behavior and expanding on the reasoning for those decisions=20 > in the RFC itself. > > =E2=80=94 Rob I've been following this thread with interest, and at the moment I'm hon= estly undecided. I certainly see the use cases for this functionality (= whatever it gets named), but as a practical matter it sounds like it int= roduces a lot of extra clunk and complexity. And it seems like the use = cases could be addressed as well with either fileprivate or module-priva= te. (The former being considerably less work.) So, how would nested classes compare to fileprivate, in terms of ability= to solve the problem space? As I understand it, the goal is: 1. Classes that can be instantiated only by the class that uses them. 2. But can be returned from that class to a caller and reused as appropr= iate. The autoloading question (loading a whole file for just an implementatio= n detail value object) is not one that carries much weight for me, as th= at's a user-space question, not an engine question. (Nothing in PHP its= elf says you cannot put 20 3 line classes or enums together in one file.= It's just PSR-4 that says not go. Even composer would allow it if conf= igured properly) So how would the less-complicated alternative compare? --Larry Garfield