Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126777 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 9A5831A00BC for ; Sat, 15 Mar 2025 10:36:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742034819; bh=0qI8NfpGFJ1k6EIdSj9S3uE6cHO1/d82SkXiYdA/h78=; h=Date:From:To:In-Reply-To:References:Subject:From; b=gYrTzeHCXb04JyLJQ1MOcg9DWw9eQRJozWhknYaRxZkDv63tXSmFW90BVfyYq062h DdV4yiiVZXEbJaQAwmBJzIhFWl6+5k8lsFWUPf62aZsewgWOPtItClbz1tGQpbHIPG s76Et8gRn06KmHP4O1WOp68kP/OuhgH+Vquwud5WJeHBtc7EP/Q8REUN1qBeq5Xteh eh/tCr8Mp1F/pP35P07dbqEX8D/eMnKbRFFphCO1behfByzpulN98ZB8d/EKFGwQfI Orju++6imHgYX8R5wCEuFP/kUDtlc2JTRsHh851I05tPk2ESNJSN6y1t26k2VbnOA2 xigwzb5UwLZEA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9A743180050 for ; Sat, 15 Mar 2025 10:33:36 +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 fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) (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 ; Sat, 15 Mar 2025 10:33:36 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.stl.internal (Postfix) with ESMTP id 5D13011400CC for ; Sat, 15 Mar 2025 06:36:08 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-11.internal (MEProxy); Sat, 15 Mar 2025 06:36:08 -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=1742034968; x=1742121368; bh=0qI8NfpGFJ 1k6EIdSj9S3uE6cHO1/d82SkXiYdA/h78=; b=BJKzXQpj5Gc+0t/nOR2sjH4e1k QuJrss4Aeo/O0NvHU9bMV7U7PC/+nZsHQqysf/2JSDEt9ZB+mRAWhJ+oTbeAa0tE vxE24Lm9nFk6z7391lRD1pVJgBf6L859rCAY0G/hQsJqftun5SdTb0Mp4g5hQjtM /xYX+w4RPfzq3pBa+z/pdYHSNkL67ruFBy3IFBFT8eOQmZC+u0RD+7sXPGJJw25A 4EUiqPcqtRkg2ks1wI2B+E8idQZpcHAx+xvnr2TBs+AlPsRJKaQltTBredy8E6v0 hJAEk21Y1L3JGrhfdHPEl0o1yk3fCs1pnDmY5nWFdCHHZMGAjP6YhH7Is7Sg== 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= 1742034968; x=1742121368; bh=0qI8NfpGFJ1k6EIdSj9S3uE6cHO1/d82SkX iYdA/h78=; b=FEUAziNPhNkm6tzz9zZQOftqcO7xi94e7jWDRmlq9I4qAZ/QZfJ BEiCYO4nLznDbK0NNEUCFiJGB0sMuGcYyAuLUGAS8oH7+fmYNYuY1MSN0r0LHpDx TO0p1kMdGoexq23olB/GExvKfaCWN4TH0syDtWMv08Ng+2WzELwsyhWpmOAa7QsM S+HJ65bSApXUkA9GXcQt8OHREPwgLHyDM/0O0uu5omT8FcDO8CP9NJOXsCKl0303 kVcahvVT35MO6dtLjf3XJsiNr5Dr6XW1Pv9ZWUzJuDdYUCI5X2oMbmwWvVouJHwd jaSHvUHiyY4ufoI7s6XovVxPTVwFV9q6Lfw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddufeefgeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefogg ffhffvkfgjfhfutgesrgdtreerredtjeenucfhrhhomhepfdftohgsucfnrghnuggvrhhs fdcuoehrohgssegsohhtthhlvggurdgtohguvghsqeenucggtffrrghtthgvrhhnpeelke ehtdfgfefhleeilefggeeihfekvdelfeejtdfflefhheehfffgudetuddutdenucffohhm rghinhepphhhphdrnhgvthenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpehrohgssegsohhtthhlvggurdgtohguvghspdhnsggprhgtphhtthho pedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlih hsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id DC074780068; Sat, 15 Mar 2025 06:36:07 -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: Sat, 15 Mar 2025 11:35:46 +0100 To: internals@lists.php.net Message-ID: <9a6ebdaf-596b-45e1-8214-ca39276890bf@app.fastmail.com> In-Reply-To: References: <70f34dcf-e4b6-4d92-8417-83ebeb03153c@rwec.co.uk> Subject: Re: [PHP-DEV] RFC: short and inner classes Content-Type: multipart/alternative; boundary=4a642c9c8e7b42acb6f563b01e895a73 From: rob@bottled.codes ("Rob Landers") --4a642c9c8e7b42acb6f563b01e895a73 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sat, Mar 15, 2025, at 01:01, Rob Landers wrote: >=20 >=20 > On Sat, Mar 15, 2025, at 00:21, Rowan Tommins [IMSoP] wrote: >> On 05/03/2025 23:11, Rob Landers wrote: >> > >> > I'd like to introduce my RFC for discussion:=20 >> > https://wiki.php.net/rfc/short-and-inner-classes >>=20 >>=20 >> As a user, I find the concept of inner classes quite confusing. >>=20 >> However, I was looking at some code earlier and thought an "inner enu= m"=20 >> would be useful, to replace various "MODE_FOO" type class constants -=20 >> but I see those are left to future scope. :( >=20 > Actually, it appears I did not limit it in the implementation... So, m= aybe we could play with it and see what breaks. I simply left traits, en= ums, and interfaces to future scope because 1) I didn't have a working i= mplementation yet, 2) had no idea what would break and 3) every time som= eone suggests a change to enums, the discussion explodes. >=20 > Having inner enums, traits, and interfaces is actually quite simple. M= ight as well see how simple. :) But fwiw, I do plan on a near immediate = RFC(s) for these if this thing passes, as well as short classes -- I als= o have a semi-finished draft with short enums as well, but that one is a= ctually physically impossible without making 'enum' a true reserved word= . The "hack" (if you will) to bypass that requirement is still in place = and makes the grammar (likely) impossible. >=20 > I will have to fix this tomorrow, because I am not a fan of having inn= er classes on interfaces, at least. I will play with it on enums and tra= its and see what breaks. I suspect inner classes on traits will cause ut= ter chaos. >=20 >> I'm aware they exist in a lot of other languages, though, so I though= t=20 >> I'd look around at how the proposed version compares. It seems there'= s=20 >> quite a zoo out there... >>=20 >> One common theme I do note is that all four of the pages I found are=20 >> titled "nested classes" or "nested types"; in some cases, "inner=20 >> class"/"inner type" has a specific meaning, which I don't think match= es=20 >> the RFC's proposal. >=20 > I actually borrowed heavily from C#. I'm familiar with its usage and r= ules, and it fits nicely with PHP paradigms. >=20 > =E2=80=94 Rob After playing around with it in enums, traits, and even interfaces, I've= decided to allow it in them all. I've updated the RFC, fixed an issue i= n the implementation, and clarified some poorly worded sections. I've al= so added more realistic examples. =E2=80=94 Rob --4a642c9c8e7b42acb6f563b01e895a73 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Sat, Mar = 15, 2025, at 01:01, Rob Landers wrote:


On Sat, Mar 15= , 2025, at 00:21, Rowan Tommins [IMSoP] wrote:
On 05/03/2025 23:11, Rob Landers = wrote:
>
> I'd like to introduce my RF= C for discussion: 


As a user,= I find the concept of inner classes quite confusing.

=
However, I was looking at some code earlier and thought an "i= nner enum" 
would be useful, to replace various "MODE= _FOO" type class constants - 
but I see those are lef= t to future scope. :(

Actually= , it appears I did not limit it in the implementation... So, maybe we co= uld play with it and see what breaks. I simply left traits, enums, and i= nterfaces to future scope because 1) I didn't have a working implementat= ion yet, 2) had no idea what would break and 3) every time someone sugge= sts a change to enums, the discussion explodes.

=
Having inner enums, traits, and interfaces is actually quite simple= . Might as well see how simple. :) But fwiw, I do plan on a near immedia= te RFC(s) for these if this thing passes, as well as short classes -- I = also have a semi-finished draft with short enums as well, but that one i= s actually physically impossible without making 'enum' a true reserved w= ord. The "hack" (if you will) to bypass that requirement is still in pla= ce and makes the grammar (likely) impossible.

I will have to fix this tomorrow, because I am not a fan of having in= ner classes on interfaces, at least. I will play with it on enums and tr= aits and see what breaks. I suspect inner classes on traits will cause u= tter chaos.

I'm aware they exist in a lot of other languages, tho= ugh, so I thought 
I'd look around at how the propose= d version compares. It seems there's 
quite a zoo out= there...

One common theme I do note is tha= t all four of the pages I found are 
titled "nested c= lasses" or "nested types"; in some cases, "inner 
cla= ss"/"inner type" has a specific meaning, which I don't think matches&nbs= p;
the RFC's proposal.

I actually borrowed heavily from C#. I'm familiar with its usage = and rules, and it fits nicely with PHP paradigms.

=E2=80=94 Rob
<= br>
After playing around with it in enums, traits, and even in= terfaces, I've decided to allow it in them all. I've updated the RFC, fi= xed an issue in the implementation, and clarified some poorly worded sec= tions. I've also added more realistic examples.

=
=E2=80=94 Rob
--4a642c9c8e7b42acb6f563b01e895a73--