Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126809 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 682BB1A00BC for ; Mon, 17 Mar 2025 17:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742232515; bh=CLW645YEX8uMgSG+Y1DAYHfEhEGCtdr11wLlq373OjA=; h=Date:From:To:In-Reply-To:References:Subject:From; b=inw4I0fT8ThzbWXZn8LyzFtySpKyEAcs/6ByMYgDCQWiMWPMj7zpEUCQn9MRNCnvg giWBFdsf6xEl5hnBskHbMdSIoWpoRYZ3RVyb5YLCvXA6DES+Idkk8/L5X/WkZUtxWe EdIEccy9rm4hi/ZPRXHnnnsAJhDqiCtlPHYBzq/gSVs+UJWe3C7G3mE7WrzzAV9KMb ESY2XuZ0zYi15eK/vF5kARZHDXQXfnPMaguPtG0AFzF0yZe6RosISTNvSc5uyAiasZ xqLTM6crIR14HVWMQRpDAX80uq2asmiw5Gmykkokt6icaO2QQ+nDsCpKpN5M7ohlm9 F9KeWCAMqceaw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 2B6211801D9 for ; Mon, 17 Mar 2025 17:28:30 +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-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) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 17 Mar 2025 17:28:29 +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 7190B1140215 for ; Mon, 17 Mar 2025 13:31:01 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-11.internal (MEProxy); Mon, 17 Mar 2025 13:31:01 -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=fm2; t=1742232661; x=1742319061; bh=LL1OVKhj/7 mlCmoZq3y+RvSlOXqpUBIEtJxv256yt7Y=; b=IC4C8qqtLQeMKHoXXSCtJe0QsX GZfYif96sAEG1TyWqLGBwMKG1J7EkM/6SrWpqcEet0pYVvzRetDNOJEXMzL9icse ro8tnj8AK3L1NqVg3KgiIgKpAEHE/oMHH98e+V6qkMEiwGpQRqA/tFoC2Y4YYK/6 8XLHo+G7JJp+8Rj5seMElOWhxTQLpvaO/f10+n646XBk3/qwYGjqiotitRcvblLG qvDtG4SXGjr0xya4IO+AY1G7LDNDv03NaYR/ci5ymLrI1pBpAJY53Tw0Xtljibpb cdyB+7JjEnojbT1PlxyafDXDwwFupdVVpVRX+M7qwovlsVExLVPBDUfCNIbQ== 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=fm1; t= 1742232661; x=1742319061; bh=LL1OVKhj/7mlCmoZq3y+RvSlOXqpUBIEtJx v256yt7Y=; b=jWYDuFRvkBOVveUzyDkQDgOMySo1qmRZJ1tJ+xqvbzkbnsNEbIw NAKTXmu+/EUQqd1z/yGQdD+DeYjapi20Xit+yFSjQXIGcLfOzyuetCIXrLPsyFsO EwhVq6r/TNHoyZIL8icMhL6OsqOEg1JixXkR1rvebiRpEtaYTMgR/ZiR6ik9yqw/ HEqMHa8uh3EkDfOMa6bnqWt/skxjI+R4WjovWulaa9UT6v/SvojD4TlQs6Dj+eAo efEX2RfEJbuD4mI1wK1lr1aiaxqagEnjyfhgOV+VLwmJ7gYILF+vbSpsY91Q5liQ 1TVPJ94ABBGnLU97Bp+fhcwMdx5qmuKV1rw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddugedtuddvucetufdoteggodetrf 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 05B77780068; Mon, 17 Mar 2025 13:31:01 -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 Date: Mon, 17 Mar 2025 18:30:40 +0100 To: internals@lists.php.net Message-ID: In-Reply-To: <8e44fc5a-77f3-4c71-a47d-cee76452b23b@rwec.co.uk> References: <4abd7008-ae33-46fe-8bbd-7c99f7c48158@app.fastmail.com> <0F1E4400-5E26-4E39-88B9-ABD7ABBAEBC4@rwec.co.uk> <8bbb484b-96a3-4a3e-881e-2c47d7f433b9@app.fastmail.com> <7C4630DC-3478-4FDD-88C6-D2B27595F02A@rwec.co.uk> <8e44fc5a-77f3-4c71-a47d-cee76452b23b@rwec.co.uk> Subject: Re: [PHP-DEV] RFC: short and inner classes Content-Type: multipart/alternative; boundary=f6d9a9ac51fb4afb901ae4c8c588917a From: rob@bottled.codes ("Rob Landers") --f6d9a9ac51fb4afb901ae4c8c588917a Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, Mar 17, 2025, at 12:29, Rowan Tommins [IMSoP] wrote: > On 17/03/2025 10:37, Alexandru P=C4=83tr=C4=83nescu wrote: >>> From what I understand of the proposal, the calling code won't know = anything different based on it being "nested" or "namespaced", it will j= ust see a class with a long name with some punctuation in. >>=20 >> The problem for me is not autoloading, but that you can't have the tw= o classes defined at the same time, while using some other punctuation i= t would allow it. >> I believe that there are other operators that we can use, to allow th= is. >=20 >=20 > Again, I challenge the premise: why would you want to have both define= d at the same time? >=20 > Do developers in Java, C#, Kotlin, or Swift complain about this limita= tion? >=20 > Is there any other language which makes a syntax distinction between "= class Foo in namespace Bar" and "class Foo nested in class Bar"? >=20 No, almost no other language I know of seems to make a distinction like = PHP does. It appears that PHP is unique in this. Does that mean we can l= earn more from these other languages, or less? I=E2=80=99d be more than happy to put forward a short RFC or poll on the= syntax choices, as Alexander suggested. Even if this RFC fails, it woul= d be good to get a consensus for the future. >> (As a note, and this might have been discussed already, but I would p= refer to use the term nested class instead of inner class, as in java th= e inner classes means non-static classes, and I don't think we should go= that way.) > 100% agree. >=20 > If we did implement something more like "inner classes", a special syn= tax might make more sense - there would be a very specific relationship = between the inner and outer classes. I don't think "has special visibili= ty of members, like a friend-class or file-private feature" needs to be = highlighted in that way. >=20 I am inclined to agree with you both on this. Originally I had planned f= or an =E2=80=9Couter=E2=80=9D and =E2=80=9C$outer=E2=80=9D that made it = more like Java inner classes, but decided to leave it to a future RFC if= someone ever wanted to implement it. When I first started thinking abou= t this RFC, static classes had fairly recently failed, and I didn=E2=80=99= t want to define what a =E2=80=9Cstatic inner class=E2=80=9D was. This i= s part of the reason why =E2=80=9Cstatic=E2=80=9D isn=E2=80=99t allowed = as an inner class modifier. This may be a potential future RFC if people= have need of it. =E2=80=94 Rob --f6d9a9ac51fb4afb901ae4c8c588917a Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

=

On Mon, Mar 17, 2025, at 12:29, Rowan Tommins [IMSoP= ] wrote:
On 17/03/2025 10:37, Alexandru=0A P=C4=83= tr=C4=83nescu wrote:
From= =0A what I understand of the proposal, the calling code won't know= =0A anything different based on it being "nested" or "namespaced",= =0A it will just see a class with a long name with some punctuati= on=0A in.

The problem f= or me is not autoloading, but that you can't=0A have the two clas= ses defined at the same time, while using some=0A other punctuati= on it would allow it.
I believe that there are other opera= tors that we can use, to=0A allow this.

=

Again, I challenge the premise: why would you want to have bo= th=0A defined at the same time?

Do developers in Java, C#= , Kotlin, or Swift complain about this=0A limitation?

Is = there any other language which makes a syntax distinction=0A betwee= n "class Foo in namespace Bar" and "class Foo nested in=0A class Ba= r"?


No, almost no other language= I know of seems to make a distinction like PHP does. It appears that PH= P is unique in this. Does that mean we can learn more from these other l= anguages, or less?

I=E2=80=99d be more than= happy to put forward a short RFC or poll on the syntax choices, as Alex= ander suggested. Even if this RFC fails, it would be good to get a conse= nsus for the future.

(As a note, and this might= have been=0A discussed already, but I would prefer to use the te= rm nested=0A class instead of inner class, as in java the inner c= lasses means=0A non-static classes, and I don't think we should g= o that way.)

100% agree.

If we did implemen= t something more like "inner classes", a=0A special syntax might ma= ke more sense - there would be a very=0A specific relationship betw= een the inner and outer classes. I don't=0A think "has special visi= bility of members, like a friend-class or=0A file-private feature" = needs to be highlighted in that way.


=
I am inclined to agree with you both on this. Originally I had plan= ned for an =E2=80=9Couter=E2=80=9D and =E2=80=9C$outer=E2=80=9D that mad= e it more like Java inner classes, but decided to leave it to a future R= FC if someone ever wanted to implement it. When I first started thinking= about this RFC, static classes had fairly recently failed, and I didn=E2= =80=99t want to define what a =E2=80=9Cstatic inner class=E2=80=9D was. = This is part of the reason why =E2=80=9Cstatic=E2=80=9D isn=E2=80=99t al= lowed as an inner class modifier. This may be a potential future RFC if = people have need of it.

=E2=80=94 Rob
--f6d9a9ac51fb4afb901ae4c8c588917a--