Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126803 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 CDC4E1A00BC for ; Mon, 17 Mar 2025 11:29:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742210813; bh=7o6EMF78saNvhf9p7whY474VzbSjKjGuOnuOkynijKQ=; h=Date:Subject:To:References:From:In-Reply-To:From; b=hTjbWa68imx7XiYD75cfICdE/f0ZTCYnQngHvxo/OvV+Yc+YEeD4/wwpo8Dl/VCla khvX9pvj65a/Ru+JUR1rDZW8rikW1XeHHu5VWAgLaYCsFn8Ck6+NEiy0kqWcp/tD8T Q0WN074E5nDvqNa8ZMdYn5Nu9lZqIgEJBju9OG6tYw4eXhOvVQYmWj6bHzvCbZfrNR oaKit7pHhw+1JFY/tqIlVz5imgHswqXDxYGsAmCgfRdrMjmoEYjHS/u3f2lxXNSB16 +YYI/J6MLe/1FZ4d2Ou8KwD9neIlcqryTPMwEvu9zqW0or/117m72EUgE9WU/NdtbQ qLbFxWZgcZdNw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BDF3D18005B for ; Mon, 17 Mar 2025 11:26:52 +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-a4-smtp.messagingengine.com (fhigh-a4-smtp.messagingengine.com [103.168.172.155]) (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 11:26:52 +0000 (UTC) Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfhigh.phl.internal (Postfix) with ESMTP id D573D11401ED for ; Mon, 17 Mar 2025 07:29:23 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-07.internal (MEProxy); Mon, 17 Mar 2025 07:29:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=1742210963; x=1742297363; bh=y/edvUnQTZ ETGj7viriI9JIDnpWAJhp/tikk4GlNtsk=; b=g+adTHtap4I6uKHahkXoB4XAj2 tY22OiEaC0m/DrkcgqVSH7KjQzyFjxbJ/rhgvZcFGUDz+yj/F+uDObz5YMgPzk8d iOQac8A/PxeP8hzV76JKO/kPUXMwFilmPRMUVj5eOyPNIDnH1/o3skQsRuHXuAdd Fez5aAnwUxGj8AN/KJwFFmU9Y5Jpvfqh3WhIKTxpQ/+2DxYzIPtB0AhHOqeKy+P1 JY1FY4EsBRi3qL+om/2ylRhEWDiiJRLbiYahIZZ9UUkEYklv9jGE3xrMCFwY4ER8 JZjcctf+2arGPzjYqSR6X9l2Amdug0IcYeBAiQZj2zoYxXzr/d+YW9qjD5/Q== 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= 1742210963; x=1742297363; bh=y/edvUnQTZETGj7viriI9JIDnpWAJhp/tik k4GlNtsk=; b=znl4gylNpOvEgn4VZNi2Cjh5brusTWMhAVI0DV/x8mW2kRW7pfU EFmLthtp2d1Lz3fx3s2ESdPUVvJKklKdLVBDkHVBoi7Bk5FNksR7a1iUeZWCzXHN JyxTRowXSZfgIR0e/VPMO+3YU9C+VEKctHsG8qisVFsWeDTwHpehN/zBwsPxmbRB 6ekVLtFTGRZ/YR3DqxgZCEgUHWQDJJnMkq4FymZ/ZcxQ6ce599GGFwTIAWPuDRmJ UaHK5Fbt8YEjoVXDEQHB0Y5dWMjoPu8gZ6o6KeTVu3odYSzoLGPF9e5I2n/FdwPQ 3m0NbceW5Fu9T+YZ+QhjU1gM5Tu79/VT6Yg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddufeelfeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpegtkf ffgggfuffvfhfhjgesrgdtreertddvjeenucfhrhhomhepfdftohifrghnucfvohhmmhhi nhhsucglkffoufhorfgnfdcuoehimhhsohhprdhphhhpsehrfigvtgdrtghordhukheqne cuggftrfgrthhtvghrnhepheetleeiiefgueduieeuieffvdevheduueefkeejuefgffef tdeitdegtedtleetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepihhmshhophdrphhhphesrhifvggtrdgtohdruhhkpdhnsggprhgtphhtthho pedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlih hsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 17 Mar 2025 07:29:23 -0400 (EDT) Content-Type: multipart/alternative; boundary="------------E7kKxvaUjLIaA1eh5ofMflL7" Message-ID: <8e44fc5a-77f3-4c71-a47d-cee76452b23b@rwec.co.uk> Date: Mon, 17 Mar 2025 11:29:20 +0000 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] RFC: short and inner classes To: internals@lists.php.net 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> Content-Language: en-GB In-Reply-To: From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") This is a multi-part message in MIME format. --------------E7kKxvaUjLIaA1eh5ofMflL7 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 17/03/2025 10:37, Alexandru Pătrănescu 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 just see a class with a long name with some > punctuation in. > > > The problem for me is not autoloading, but that you can't have the two > classes defined at the same time, while using some other punctuation > it would allow it. > I believe that there are other operators that we can use, to allow this. Again, I challenge the premise: why would you want to have both defined at the same time? Do developers in Java, C#, Kotlin, or Swift complain about this limitation? Is there any other language which makes a syntax distinction between "class Foo in namespace Bar" and "class Foo nested in class Bar"? > (As a note, and this might have been discussed already, but I would > prefer to use the term nested class instead of inner class, as in java > the inner classes means non-static classes, and I don't think we > should go that way.) 100% agree. If we did implement something more like "inner classes", a special syntax might make more sense - there would be a very specific relationship between the inner and outer classes. I don't think "has special visibility of members, like a friend-class or file-private feature" needs to be highlighted in the syntax that way. -- Rowan Tommins [IMSoP] --------------E7kKxvaUjLIaA1eh5ofMflL7 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 17/03/2025 10:37, Alexandru Pătrănescu 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 just see a class with a long name with some punctuation in.


The problem for me is not autoloading, but that you can't have the two classes defined at the same time, while using some other punctuation it would allow it.
I believe that there are other operators that we can use, to allow this.


Again, I challenge the premise: why would you want to have both defined at the same time?

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

Is there any other language which makes a syntax distinction between "class Foo in namespace Bar" and "class Foo nested in class Bar"?



(As a note, and this might have been discussed already, but I would prefer to use the term nested class instead of inner class, as in java the inner classes means non-static classes, and I don't think we should go that way.)

100% agree.

If we did implement something more like "inner classes", a special syntax might make more sense - there would be a very specific relationship between the inner and outer classes. I don't think "has special visibility of members, like a friend-class or file-private feature" needs to be highlighted in the syntax that way.


-- 
Rowan Tommins
[IMSoP]
--------------E7kKxvaUjLIaA1eh5ofMflL7--