Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126774 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 178851A00BC for ; Sat, 15 Mar 2025 00:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741996832; bh=Yn8/yxYY4q/SDhe2gcjyP+KrkThvlmJHfFmkbXzSdHE=; h=Date:From:To:In-Reply-To:References:Subject:From; b=Tgq9AfRBKpz6Alu3TRFLneUe0/wqx21CctCY2pfu1MfvDnBKyxWbNcIent1FyTj1J 8Q+MGyumGdorcU0Xt+Vg/Weup6aR/BiCtORfO29FajTtytEW2/zMrBshqxGkXyoz9T ao5aI6F1n/M7ksyWbccSiULpPJBLwjofgjRVQejhLsGV449/eeuHln/T85YYonOSLL 0f7YbZ4RbYXoe4NGw+N8VSaRGwWZdf2J8kpT27QnEUUdpnHTfAx2u2M+IRckwqUMNR aIkHgfrRe/FnfXJvCPNfLkOTT80oc08nB7WFDrz5Weak2+rWU13lvX9TXUfDLKgK79 QYJRDWCTmVgew== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 59E771801E9 for ; Sat, 15 Mar 2025 00:00:31 +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-a5-smtp.messagingengine.com (fout-a5-smtp.messagingengine.com [103.168.172.148]) (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 ; Sat, 15 Mar 2025 00:00:21 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfout.phl.internal (Postfix) with ESMTP id 7FB9A138277C for ; Fri, 14 Mar 2025 20:02:53 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-11.internal (MEProxy); Fri, 14 Mar 2025 20:02:53 -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=1741996973; x=1742083373; bh=Yn8/yxYY4q /SDhe2gcjyP+KrkThvlmJHfFmkbXzSdHE=; b=hOG4QKy3hw2MQ5sB1j24Ns1pVw fsem22sn9L2fDYQQA5osny9RR67w1KBY2Y/UdaMpFp4nhDHroaZvheNroQCz0FWN ljdKLNm+trrhJJhqIbV/ARL8H6wmWICtVe2HfMzmA+7SiOwhg365UaxPo/pEjpw+ 3QFZUDdhCpIe++XzcAd7/qTVLM6k4NfkSWHjerLWYVpI/VVCwiRyALLp8pL65OXN JTphrX7ozIs7Gr3TFlhDpZIdZScsmVi0KHAxE1DNxhH7byZnpNxcGR7wqwrbLf5n W+n30HGdEsYMwRVHml9YP7SQ27TRiX3m4lCcmVhYAfuv+eBgbLX/6Lx1Np7w== 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= 1741996973; x=1742083373; bh=Yn8/yxYY4q/SDhe2gcjyP+KrkThvlmJHfFm kbXzSdHE=; b=3L11x4zHjw91lvrLhEx7KSp2wyqQS//OPA6gcxEYxXxqb/9eIaQ G3sBZOpkLNFF3V30HReoOWoiBEuwUGCxThbK3xhI6CHtxNmr+TynlA38W52OWHWQ CX4+JANToUuaghx8XNMXy5S8FWl9nHlJr6Nkjkzi0wWcBE3jKVVuvi7ZCu6/7cK/ 9IRInY6aOL7xHvXoDQE1ED1K24HC0vPEcpSHMSyysIr98yLbQ4hXxv4MJG0ddbNL 62EyNsvNc0tvW3l0yLV0HPuRhslTeF2WNVbTZ1PR+CrpX71lPB2e+5wjL00OsYXc hst0xh6KKqjTW3uP0lw+oCMoS5hSgwvGcXQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddufedvvddvucetufdoteggodetrf 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 4972C780068; Fri, 14 Mar 2025 20:02:52 -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 01:01:26 +0100 To: internals@lists.php.net Message-ID: In-Reply-To: <70f34dcf-e4b6-4d92-8417-83ebeb03153c@rwec.co.uk> References: <70f34dcf-e4b6-4d92-8417-83ebeb03153c@rwec.co.uk> Subject: Re: [PHP-DEV] RFC: short and inner classes Content-Type: multipart/alternative; boundary=d50916ec603d4ca3a411b680eb5d8397 From: rob@bottled.codes ("Rob Landers") --d50916ec603d4ca3a411b680eb5d8397 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 enum= "=20 > would be useful, to replace various "MODE_FOO" type class constants -=20 > but I see those are left to future scope. :( Actually, it appears I did not limit it in the implementation... So, may= be we could play with it and see what breaks. I simply left traits, enum= s, and interfaces to future scope because 1) I didn't have a working imp= lementation yet, 2) had no idea what would break and 3) every time someo= ne suggests a change to enums, the discussion explodes. Having inner enums, traits, and interfaces is actually quite simple. Mig= ht as well see how simple. :) But fwiw, I do plan on a near immediate RF= C(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 is act= ually physically impossible without making 'enum' a true reserved word. = The "hack" (if you will) to bypass that requirement is still in place an= d makes the grammar (likely) impossible. I will have to fix this tomorrow, because I am not a fan of having inner= classes on interfaces, at least. I will play with it on enums and trait= s and see what breaks. I suspect inner classes on traits will cause utte= r chaos. > I'm aware they exist in a lot of other languages, though, so I thought=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 matche= s=20 > the RFC's proposal. I actually borrowed heavily from C#. I'm familiar with its usage and rul= es, and it fits nicely with PHP paradigms. =E2=80=94 Rob --d50916ec603d4ca3a411b680eb5d8397 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

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


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

However, I was looking at some code= earlier and thought an "inner enum" 
would be useful= , to replace various "MODE_FOO" type class constants - 
but I see those are left to future scope. :(

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

Having inner enums, traits, and interface= s is actually quite simple. Might as well see how simple. :) But fwiw, I= do plan on a near immediate RFC(s) for these if this thing passes, as w= ell as short classes -- I also have a semi-finished draft with short enu= ms as well, but that one is actually physically impossible without makin= g 'enum' a true reserved word. The "hack" (if you will) to bypass that r= equirement is still in place and makes the grammar (likely) impossible.<= br>

I will have to fix this tomorrow, because I= am not a fan of having inner classes on interfaces, at least. I will pl= ay with it on enums and traits and see what breaks. I suspect inner clas= ses on traits will cause utter chaos.

I'm aware they exist in a lot of o= ther languages, though, so I thought 
I'd look around= at how the proposed version compares. It seems there's 
<= div>quite a zoo out there...

One common the= me I do note is that all four of the pages I found are 
titled "nested classes" or "nested types"; in some cases, "inner = ;
class"/"inner type" has a specific meaning, which I don'= t think matches 
the RFC's proposal.

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

=E2=80=94 Rob
--d50916ec603d4ca3a411b680eb5d8397--