Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:127296 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 lists.php.net (Postfix) with ESMTPS id 83EA11A00BC for ; Tue, 6 May 2025 20:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1746561758; bh=qefC8VOo2pVQUqdEPT53x+opjY+Mo0Gnz5bd6nZwiuU=; h=Date:From:To:In-Reply-To:References:Subject:From; b=nye3keAmGeEK/DeQ9kDmAkuaPek9gI1dDCPBtglvfXntRxSm4n609nmvZCv80kbAc gttHZfP77mwHbS/+u0hJoYPrGPx0TJk/BWa65qiVZmF2Uhai/On78F37pkoC2Pag/H vUNvmy7vyKsWlbyCa5+ilDfGmpsLIzXHXdTZPElhdj3bPluYTeJaii3VMO8zqR0hQ2 g7iTgEQj6/lkK7lFvQBINvJbjWkmDcFmmUuPD+tG1soyRWatgk1tqGA3FiEmUSp2Db l/w/JiTuVbCWD6ia2ib6VM31EuMz5WjjZLHezLxOKSbadzBowABCnmcFCG+PpYL2Ly sU4vtCSj7i6Mw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D950E180074 for ; Tue, 6 May 2025 20:02: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=-0.9 required=5.0 tests=BAYES_20,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: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (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 ; Tue, 6 May 2025 20:02:36 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.phl.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 36F101140282; Tue, 6 May 2025 16:04:50 -0400 (EDT) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-05.internal (MEProxy); Tue, 06 May 2025 16:04:50 -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=fm1; t=1746561890; x=1746648290; bh=qefC8VOo2p VQUqdEPT53x+opjY+Mo0Gnz5bd6nZwiuU=; b=HrgJvp1ivA2j4e7Idd/OrAlh4d 14ZiuZhe+0wXjQFoOoztWd6qzGtTtu+T2yxdN98ZzYMkX1TAr0VHBLkR4ORruS7M ajw1hVChtbwhFrYbH61ie71pbzRwE/xjz7P63oKJuIcigTjZuXHj8oHk9JV8XAqZ 3I82MYVQIM+3FiFJz57U3qwgruB5EBi+dMdlv45bCAHgSYlCn9UTDmMfufaJZjof G2zE1fzc94OLXlj5iKCkYwzfcyirfs9rEuEmg1UrfuQJzYfjyouTba0IWCg5ljYa fNN0UCOMtlFdKYuRa7khkW+mTiLE0LR1oWb2D4sGEzXrn+TN9PSACzi0Fh1Q== 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=fm3; t= 1746561890; x=1746648290; bh=qefC8VOo2pVQUqdEPT53x+opjY+Mo0Gnz5b d6nZwiuU=; b=lCySD5y5Tl7zIsRvaeSGE+hsnbFN3Tml384pCW3EEAwUUHJKP2M 7cliW1EwdRtSynWnzkBjAfzW4QQhsIpyxH2TSMfcjtGCKeWSbz91r1zqt+CegzZI VMZGlcqon9sRkFwtbY34p/ayd9J3W5mBIa+me1Ej4V6GpTF6+Bu37fakqLQRpA/Z bjfERU35JSEvYCj5d+bSsTj8+FCx//R4Wb75sDiD67fP/oxRmWUKQwaF37X7rdMf idQ/C/AR1GIXLuiuyb7uVGnCZVvbNsG3UShltIFkeM99CKgqSKIazGh8JkfoJHJA SodSDxHY/IDVQ7NsRSrBgpkdm2L/XLjugdw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvkeegkeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpih gvnhhtshculddquddttddmnecujfgurhepofggfffhvffkjghfufgtsegrtderreertdej necuhfhrohhmpedftfhosgcunfgrnhguvghrshdfuceorhhosgessghothhtlhgvugdrtg houggvsheqnecuggftrfgrthhtvghrnheptdeujedttefhueelhfdtleeiudetlefftddu leehffegtdeihefhleeijefgveegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrg hmpehmrghilhhfrhhomheprhhosgessghothhtlhgvugdrtghouggvshdpnhgspghrtghp thhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepthhimhessggrshhtvg hlshhtuhdrsggvpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdr nhgvthdprhgtphhtthhopehimhhsohhprdhphhhpsehrfigvtgdrtghordhukh X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 61BF7780069; Tue, 6 May 2025 16:04:49 -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: Te5d7a0ed2909808f Date: Tue, 06 May 2025 22:04:28 +0200 To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= , "Rowan Tommins [IMSoP]" , internals@lists.php.net Message-ID: <386b4359-be5b-4872-b2c1-c8211a08d7dd@app.fastmail.com> In-Reply-To: <681845d2-ff1e-4ab8-97b2-50fecfdcb62b@bastelstu.be> References: <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> <706e22d7-94eb-44bd-a280-f629ba93b630@app.fastmail.com> <03a5b9a8-9fe1-4656-ab04-dd58669488b3@app.fastmail.com> <158a5d7c-8ef6-4b5f-b8ef-593879a7a896@bastelstu.be> <72ef8352-2afb-4024-b4ae-857fcd94edd6@app.fastmail.com> <213a8711-adbc-42b7-bcb8-86e64cb22cf2@bastelstu.be> <5A723310-1AB6-4D4A-88CC-52EC4E81AE5C@rwec.co.uk> <681845d2-ff1e-4ab8-97b2-50fecfdcb62b@bastelstu.be> Subject: Re: [PHP-DEV] Re: RFC: Nested Classes Content-Type: multipart/alternative; boundary=91f9711e698a46c49d6bea39f6933770 From: rob@bottled.codes ("Rob Landers") --91f9711e698a46c49d6bea39f6933770 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun, May 4, 2025, at 15:52, Tim D=C3=BCsterhus wrote: > Hi >=20 > On 4/30/25 12:51, Rowan Tommins [IMSoP] wrote: > > I think you are insisting on a different definition of "private" for= nested classes than exists anywhere else in the language, and one that = I've not seen evidence of in any other similar language either. It seems= you want members to be "hidden", such that you can't even know they exi= st. >=20 > No, I don't think I'm using a different definition of "private" for=20 > nested classes. >=20 > > More specifically, you want their *fully-qualified name* to somehow = be available for reuse. That's not how private members of a class work -= methods A::foo() and B::foo() have different fully-qualified names, as = do properties A::$foo and B::$foo, regardless of visibility and inherita= nce. It's not how "namespace private", "module private", or "file privat= e" classes would naturally work, because they all would need to be refer= enceable with fully-qualified names within the scope where they were vis= ible. > The difference is that for private class members there is no chance of=20 > name collisions of the "fully-qualified" name, but there is for nested=20 > classes as proposed in this RFC. There is no way for anyone except for=20 > the author of the class `A` to create a property with the fully=20 > qualified name `A::$foo`. Granted, properties could be inherited from = a=20 > parent class and might thus cause collisions with a private property i= n=20 > a subclass. However the same collision would happen if the child class=20 > would already have a public property of the same name. Importantly, th= e=20 > child class could just rename its private property without any effect = on=20 > any other class and also parent classes can introduce private properti= es=20 > without any effect on any other class. >=20 > This is difference for nested classes as proposed in this RFC, since t= he=20 > namespace of nested classes is shared with the namespace of regular=20 > classes and the namespace of regular classes is not =E2=80=9Cclosed of= f=E2=80=9D for=20 > addition after the initial declaration. >=20 > > It's also not a new problem: PHP doesn't enforce a file and director= y layout, and libraries can and do define things "inside" each other's n= amespaces. When declaring a class, you have to be aware of whether a cla= ss with the same fully-qualified name has been, or will be, declared in = another file. >=20 > This is correct, but all these other classes that could conflict are=20 > part of the *public API* of a library. But now with private nested=20 > classes I would also be aware of the private part of a library to avoi= d=20 > conflicts. >=20 > Best regards > Tim D=C3=BCsterhus >=20 Hi Tim, I think these are fundamental problems (if they are a problem at all) wi= th how PHP currently does namespaces and names. I'm curious if you would= vote "no" for namespace visibility as well? While not intended to be us= ed as "modules," this has many of the same constraints and effects that = full namespace visibility would have=E2=80=94including the same problems= you allude to here. As I was going to work on short syntax classes next if this one passed, = as well as namespace visibility/modules after that (regardless of this R= FC passing), I'd really like to know if this behavior is that big of an = issue. If so, it is probably not worth pursuing namespace visibility if = this RFC fails. For everyone else who voted "no"; I would sincerely love to know the rea= son. Even if you just email me directly; it would really help me underst= and what can be improved in any future RFCs. =E2=80=94 Rob --91f9711e698a46c49d6bea39f6933770 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
On Sun, May = 4, 2025, at 15:52, Tim D=C3=BCsterhus wrote:
Hi

On 4/30/25 12:= 51, Rowan Tommins [IMSoP] wrote:
> I think you are insistin= g on a different definition of "private" for nested classes than exists = anywhere else in the language, and one that I've not seen evidence of in= any other similar language either. It seems you want members to be "hid= den", such that you can't even know they exist.

No, I don't think I'm using a different definition of "private" for&nbs= p;
nested classes.

> More specific= ally, you want their *fully-qualified name* to somehow be available for = reuse. That's not how private members of a class work - methods A::foo()= and B::foo() have different fully-qualified names, as do properties A::= $foo and B::$foo, regardless of visibility and inheritance. It's not how= "namespace private", "module private", or "file private" classes would = naturally work, because they all would need to be referenceable with ful= ly-qualified names within the scope where they were visible.
T= he difference is that for private class members there is no chance of&nb= sp;
name collisions of the "fully-qualified" name, but there i= s for nested 
classes as proposed in this RFC. There is n= o way for anyone except for 
the author of the class `A` = to create a property with the fully 
qualified name `A::$= foo`. Granted, properties could be inherited from a 
pare= nt class and might thus cause collisions with a private property in = ;
a subclass. However the same collision would happen if the c= hild class 
would already have a public property of the s= ame name. Importantly, the 
child class could just rename= its private property without any effect on 
any other cl= ass and also parent classes can introduce private properties 
=
without any effect on any other class.

Thi= s is difference for nested classes as proposed in this RFC, since the&nb= sp;
namespace of nested classes is shared with the namespace o= f regular 
classes and the namespace of regular classes i= s not =E2=80=9Cclosed off=E2=80=9D for 
addition after th= e initial declaration.

> It's also not a new= problem: PHP doesn't enforce a file and directory layout, and libraries= can and do define things "inside" each other's namespaces. When declari= ng a class, you have to be aware of whether a class with the same fully-= qualified name has been, or will be, declared in another file.

This is correct, but all these other classes that could = conflict are 
part of the *public API* of a library. But = now with private nested 
classes I would also be aware of= the private part of a library to avoid 
conflicts.
=

Best regards
Tim D=C3=BCsterhus
=

Hi Tim,

<= div>I think these are fundamental problems (if they are a problem at all= ) with how PHP currently does namespaces and names. I'm curious if you w= ould vote "no" for namespace visibility as well? While not intended to b= e used as "modules," this has many of the same constraints and effects t= hat full namespace visibility would have=E2=80=94including the same prob= lems you allude to here.

As I was going to work= on short syntax classes next if this one passed, as well as namespace v= isibility/modules after that (regardless of this RFC passing), I'd reall= y like to know if this behavior is that big of an issue. If so, it is pr= obably not worth pursuing namespace visibility if this RFC fails.
<= div>
For everyone else who voted "no"; I would sincerely l= ove to know the reason. Even if you just email me directly; it would rea= lly help me understand what can be improved in any future RFCs.

=E2=80=94 Rob
--91f9711e698a46c49d6bea39f6933770--