Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126943 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 E7F101A00BC for ; Tue, 25 Mar 2025 21:24:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742937702; bh=/3A1Jqudl4zA0Y85Immd/K3ZfLO6dyUfHA0ckKJYe3o=; h=Date:From:To:In-Reply-To:References:Subject:From; b=ViFZPX3GiwV358WytcqqTyKK2Zk5wiB3Avp1Krw6wlLGjjsW6ZLec2DwD0NqHHXwH ZPygqWkwRUV25TjtKD1QTx4AzVeBm10SdG7trY0QniSBQ9N/SfttKt4IzZC6ueIsnr X4BggNZ5nGUPGIuFwhSeBNj8GDGtY8S393CFrpFXMLEKmjzdHq+HYhPgZQuN0TDUiO CgRbBdR1CrXG8Q50UNYm4r7oXbpD+Nr3kPO7oKa1+P/y3+3vkmJZulY/JUgp/n9wo3 vOj/Uht9jxZEB1rwil5CcssjibPTuMgDzc/Myxf/22NzF7H6wKmtoX5kUaigqY5WJR S6wEvNKXC5izQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 557E71804D9 for ; Tue, 25 Mar 2025 21:21:41 +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,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b5-smtp.messagingengine.com (fhigh-b5-smtp.messagingengine.com [202.12.124.156]) (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 ; Tue, 25 Mar 2025 21:21:41 +0000 (UTC) Received: from phl-compute-11.internal (phl-compute-11.phl.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id EF484254010D for ; Tue, 25 Mar 2025 17:24:09 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-11.internal (MEProxy); Tue, 25 Mar 2025 17:24:10 -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=1742937849; x=1743024249; bh=/3A1Jqudl4 zA0Y85Immd/K3ZfLO6dyUfHA0ckKJYe3o=; b=LRev7dTc1Ph0jDjskIGUMNMzew 4dzis3qdeXVcTHpbDhVPkIHEOnhBQmj5Xp5c4exikZGb/hjJAHH6oSZCeMVUL0H5 qGnlRapN/JqpqfLQtGSnQT0Ya6SYH7z2GCat4GpMp3aAFNXpfUmsNgV+OZocPRE9 4txyZnP+OPv/BwN6+pPRDPWQiLTIzm5HLmz3LI4WANBmQkwoQlTZRfGP0VrDVM05 wSWXV1GNBTW4rzIcz+FFB9YSK/Kt2pbmvPptDirzyE+JXNbDXpdvPIa/9xOg7AOE vZetV63WNHTyeoCM89u1N1kGhLOsj9SYj2DLnh1aK9+XSuTPuTUvkxRjxt2Q== 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= 1742937849; x=1743024249; bh=/3A1Jqudl4zA0Y85Immd/K3ZfLO6dyUfHA0 ckKJYe3o=; b=hC/EiQboum5L1cEIDQQRaY6HQjNeLNBKPLq/pHZn/QqvxdsX6Va Hnwt09pWfV66wHlxPTM18Psw3l0hXZOSo6CdKwhW8LwEu5e2A6z0d7fp6AB4VD2+ dSYmF+HPr1P0W7bGhVZ6KpmcrfnrY+MptYXcWpGa5Ce3GEsG/3POCsSl7ILk5XDf JRRHqEp7Xl3PKm765s8Nqm7NelhUTYDC5yGr52HopDINdyAeAAhJ+fXgfXvolxWv EY9pt1orMu+QTpi3GVfcRI2IDkgTZO6dmin7fxaeYnpWTI9dJpa2ZxHyh3P/HRiW 3Yb9MsnDx2JOv1DtyGKNqXVV9XEBslNTKSA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduieefjedvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucgoufhushhpvggtth ffohhmrghinhculdegledmnecujfgurhepofggfffhvffkjghfufgtsegrtderreertdej necuhfhrohhmpedftfhosgcunfgrnhguvghrshdfuceorhhosgessghothhtlhgvugdrtg houggvsheqnecuggftrfgrthhtvghrnheptdeitddvvdevhfdufffhgeelffetgeffveek heekfeeluedutdeiveekvdetjedvnecuffhomhgrihhnpeefvheglhdrohhrghenucevlh hushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehrohgssegsohht thhlvggurdgtohguvghspdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuth dprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 856EC780068; Tue, 25 Mar 2025 17:24:09 -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: Tb30aece9847cbd48 Date: Tue, 25 Mar 2025 22:23:48 +0100 To: internals@lists.php.net Message-ID: In-Reply-To: References: <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> Subject: Re: [PHP-DEV] RFC: short and inner classes Content-Type: multipart/alternative; boundary=0a598d0619654d91821bbc203969826e From: rob@bottled.codes ("Rob Landers") --0a598d0619654d91821bbc203969826e Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Mar 25, 2025, at 22:05, Rowan Tommins [IMSoP] wrote: >=20 >=20 > On 25 March 2025 20:29:16 GMT, Rob Landers wrote: > > Personally, I'd feel that file-private should be kept as simple as p= ossible and limit it to "top-level" things, but that doesn't necessarily= have to be the case. If we did allow it on methods/properties, when mix= ing it with regular visibility, what happens? `fileprivate public privat= e(set)` ... means what exactly? >=20 >=20 > If we didn't have "protected", would you ask the same about "protected= private"? "fileprivate" would be just another access level, not somethi= ng you'd combine with existing ones. Actually, probably yes :) Mostly just to ask for clarification. In this = case though, we have private(set) and protected(set); would we also want= fileprivate(set)? That's what I was getting at. How do we mix/match up = all these things? >=20 > > maybe `fileprivate` on a property means `public` in the file, but `p= rivate` outside the file. But then how would that intersect with inherit= ance? >=20 >=20 > That was the point of my philosophical rambling about Swift: you don't= have to define new access levels in relation to old ones, or new featur= es as exceptions to old definitions. >=20 > You can just define the keywords you allow, and the access they provid= e. That's true whether you're defining "private", "fileprivate", or "acc= ess_level_42". >=20 > For instance, "fileprivate" could simply mean "accessible from any cod= e defined in this file". Since classes are fully declared in one file, t= hat makes it a strict superset of the access currently meant by "private= ", and applies equally well to a whole type, a method, or a property. >=20 > I see no reason for inheritance to be involved at all. If we want an a= ccess level that means "accessible from any code in this file, or any su= bclass of the current type", we can make up a keyword for that as well -= "fileprotected", or "fileprivate_or_protected", or whatever. >=20 >=20 > Rowan Tommins > [IMSoP] Inheritance gets involved in traits. Traits do "inherit" private access = properties (currently): https://3v4l.org/89I7A Would file-private properties/methods also be available outside the file= , or would those allow access from inside the new file? Or both? =E2=80=94 Rob --0a598d0619654d91821bbc203969826e Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

=
On Tue, Mar 25, 2025, at 22:05, Rowan Tommins [IMSoP] wro= te:


On 25 March 2025 20:29:16 GMT, Rob Landers <rob@bottled.codes> wrote:
<= /div>
> Personally, I'd feel that file-private should be kept as = simple as possible and limit it to "top-level" things, but that doesn't = necessarily have to be the case. If we did allow it on methods/propertie= s, when mixing it with regular visibility, what happens? `fileprivate pu= blic private(set)` ... means what exactly?

=
If we didn't have "protected", would you ask the same abo= ut "protected private"? "fileprivate" would be just another access level= , not something you'd combine with existing ones.
=

Actually, probably yes :) Mostly just to ask for cla= rification. In this case though, we have private(set) and protected(set)= ; would we also want fileprivate(set)? That's what I was getting at. How= do we mix/match up all these things?


> maybe `filepri= vate` on a property means `public` in the file, but `private` outside th= e file. But then how would that intersect with inheritance?


That was the point of my philosophical r= ambling about Swift: you don't have to define new access levels in relat= ion to old ones, or new features as exceptions to old definitions.

You can just define the keywords you allow, and = the access they provide. That's true whether you're defining "private", = "fileprivate", or "access_level_42".

For in= stance, "fileprivate" could simply mean "accessible from any code define= d in this file". Since classes are fully declared in one file, that make= s it a strict superset of the access currently meant by "private", and a= pplies equally well to a whole type, a method, or a property.
<= div>
I see no reason for inheritance to be involved at all= . If we want an access level that means "accessible from any code in thi= s file, or any subclass of the current type", we can make up a keyword f= or that as well - "fileprotected", or "fileprivate_or_protected", or wha= tever.


Rowan Tommins
[IMSoP]

Inheritance get= s involved in traits. Traits do "inherit" private access properties (cur= rently): https://3v4l.org/89I7A<= /a>


--0a598d0619654d91821bbc203969826e--