Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126743 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 B138C1A00BC for ; Thu, 13 Mar 2025 22:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1741904673; bh=2fAkhxnJP6snKrLYhBxIv3CWHFVAsRFVDYM/SB74FPU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ILbmV7JH0gtLYX1kz84DHkZ9dRfe9fD63V4izJEE4q2u8dIL27VFKH9PaNJunrs+A Wt505Ih4cwe2HYYBCgzgt0sVnzCvYot+YsPRsCNHmO2KRy7rYpZPJlq0xY953+uDj/ PI5qjF34nig4rzi9ApYiFc1zXTjGdmfBDsPPtpz81a58fv3vXkZhBd4GbTPYAg3baX ZwjkA79msHYLo1cxGztswgl7Mv4rsneaNohUeVTMewtqkCGjSEG+9AiCjz0d+7l3Az j/kw26LiYz/eVmXagZDk/59Fd3Ngn0X0fHVJRCewqcQYTD6o3yrazCYYCDxxfUD31s qO4/Vy1ypVY/w== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 21099180084 for ; Thu, 13 Mar 2025 22:24:32 +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=-3.6 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05olkn2025.outbound.protection.outlook.com [40.92.90.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 13 Mar 2025 22:24:28 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DqZsPC7l5QqbkEt96wWUYCD2DCvTeSUY2TKlPLRF7Ew6ZbLuz47Ap68Eh7y2ch7lK0hkffa2DcBZ7NC7VHLDTLVkr3MvXnTR3lwYS9i6s/SwnvEgRtzlSmE2CV2aLWaVO5ufHRIN6h6oYdmMohhlPtFxaZlnW1UW07o69F5plafJXdc/oyJzOQiTlA7JYwRatOB9dyAhuKRuUDGPToRnO1SQqFa5lYAL3Dba0frmPrVS6nEkArQspGC6SzU+DMa1tbQs0v9W4GA5a1DAJVA6kNrt/7wKis6qVW2Nm7zaUtEKbufB9Sx/Nxn3aA+QeSYTNMhe3dcs/KB6J86WJTs9ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iJT8MSaSiakaC+s0f1v4aVDzeMU5LEV25gO9BZG3Pn8=; b=DT5nYSPdYHWne4x0/AcwiO/IVKG5sMllVG0UdwlA0AZXipITecPbAPuYcfxor+8G+I+ISr80YimEAp214+Y2ozEuZEw1b2gHnZVoV37oNdQXscpk95QdiG+aN3W6iaRx0UowfGIYl2Jl0cMQcGUZXrONumx0YJiimvqp8pNbpx8ibPDksoWBek2WQiMs3Med7Fpet5uS9VdrkRb46+xGDbdPNgOf2ZkGODcMQLKpCj0z5PkQ4JUJp9+XOKr8+Xo74vIOR7Uwd/IOCY6sfcTsnSdL13yQ0GBznm7wOns9B3ThBKtaU0dV8GIL2YItx2cYXrF/Twt7/i7OAwKB0AarKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iJT8MSaSiakaC+s0f1v4aVDzeMU5LEV25gO9BZG3Pn8=; b=HuvU1ZuX7yAQ95Jlne91M27xB0ZISmj/KW6FMZ36HYEqfzJwY4dc+k7JLnucZZTd68U94puOTJxaBzdazMhOoXKv2LOX36gx1ycbawYy/tpsMwOSqe1drbyftOCtBzn6XvcrsOcOZFEY6cmB9hzX84Tf2SM4oFyoe7EyajHR39a5TcMsoOB+TQpnNZ4n4XYCl+l4E6xbZn0t1gC1WuKcdAe6FjanQG0iIwB9slN/pXCwCzmxc4nQjtyVPy7eR8h3NJ5nNF+CvI0XDt9S9qbOiSpbX5PbLaH25fnP1yIvkcCO4una5SW5r7duzTsi/CTKg64sG+rZBcCuaxeBcg8Jfw== Received: from AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) by AS1P250MB0408.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:4aa::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.28; Thu, 13 Mar 2025 22:26:58 +0000 Received: from AM8P250MB0170.EURP250.PROD.OUTLOOK.COM ([fe80::651e:bbd2:b18a:80ff]) by AM8P250MB0170.EURP250.PROD.OUTLOOK.COM ([fe80::651e:bbd2:b18a:80ff%3]) with mapi id 15.20.8534.027; Thu, 13 Mar 2025 22:26:58 +0000 Content-Type: multipart/alternative; boundary="------------yHQqLdxjYiSMQIPQbhxIX52t" Message-ID: Date: Thu, 13 Mar 2025 23:26:57 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PHP-DEV] Re: RFC: short and inner classes To: Rob Landers Cc: internals@lists.php.net, =?UTF-8?Q?Tim_D=C3=BCsterhus?= References: <2935d0e2-ddc4-447c-ab37-c9b7337b8b60@app.fastmail.com> <0d94bf183543ee9948fcd31337198438@bastelstu.be> Content-Language: en-US In-Reply-To: X-ClientProxiedBy: FR3P281CA0068.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:4b::15) To AM8P250MB0170.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:321::21) X-Microsoft-Original-Message-ID: Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM8P250MB0170:EE_|AS1P250MB0408:EE_ X-MS-Office365-Filtering-Correlation-Id: 7eb6f0d0-7db7-48ae-676d-08dd627e2af4 X-Microsoft-Antispam: BCL:0;ARA:14566002|7092599003|15080799006|8060799006|12050799009|5072599009|8022599003|12121999004|461199028|9400799030|19110799003|1602099012|440099028|10035399004|19061999003|4302099013|3412199025|19111999003; X-Microsoft-Antispam-Message-Info: =?utf-8?B?djc3MWZlSDBIU3FPZEVTbzdlQ3JvTkl1cUY0T3hiYTZRZzR5UENXdlBHSVBy?= =?utf-8?B?bE5NcHJ5WW80RXhyMC82MEJoYkRQeTN3WFo3UlpzV0E3OGdxMldoYkh5dlVQ?= =?utf-8?B?Y1dkNW1qTTRDckMyMzJpUEh2SWJZUFl1dWtnNGgveTdIbDZrbVJQU0crYnM2?= =?utf-8?B?Ty9SYzI2MU12MXZBUnVHemhXdk4vWVd0MkRCRm03UEtreVlSZkVROGZiVTc1?= =?utf-8?B?WXR2cVB1czZPaWlhdUtFMW1oaktxeHFmQUt5dG5JeEk2alFWS045c0d6VzhZ?= =?utf-8?B?QTlLT3FFL1lndVJjanNlcmM2N3NnRFlWZUlKVnR1bktNVUpmbkJEbVV1NmpS?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RoWDBiRlpVN1FZYURTL2FxSkhnSmFQOU95WkRoVHVsbTdIZHVB?= =?utf-8?B?L3VUejNYU3lhLzdWVVM0VlZwc1lFdURQSDdkNUlnTm1yQ2RLWkQ4YjNJWGo1?= =?utf-8?B?TXd3b0tnS2Z2SDQvTkN1YUNJenpKcmZSc0toUGNia3ZIY1NtQlFNRVdSRkxN?= =?utf-8?B?bStCTk1LUGlsNzFCQnZvUTUrUkp0cHZnUjdQZEVyTXV0MGtQZ25Td1BsclVw?= =?utf-8?B?OS9uNGRxNEszanVUL1dqNXJ0WS9HTS9rZVdncXdsSmdabU51bjBxS0RmQ21H?= =?utf-8?B?T3Eza3lYM01kbjBqVVFPb2xoYkxGOTg4N1JQK0hkZ0JBVUdURDZLTFF6T1A3?= =?utf-8?B?bTdQL1dJeHNUUy9aMEZxQlg3bkNtMlU5RVByOC9IVEx2b2o0ZEFaM25xMkRU?= =?utf-8?B?eW5UdGROOCtDTERMaHJ3ZEl6Rnl0d3I1dUdJd0ZGNkNVRlhERnlWdGl1WUR0?= =?utf-8?B?ZHhwUmtzeEY0QU9aTnd5U1d1OWpaV204aHFQQ3J3M1Bqb2lacy9GNUJTZWFp?= =?utf-8?B?YUltdTYxcTZHcnBXNit4MjBGV3c2R2RYR0U4UFFBSTgzVndoQzd5MHhOUzdk?= =?utf-8?B?RDFLcUt6bWhWNmg0WVBzQUNzem90MWR3NlF6bVI3NHBFYXlxK2puckVoaC9t?= =?utf-8?B?ZVVRazN6L1FWQkpPd0YybHNuVkdxM3hsRnBnaUtZczQ5YlpWSS95VXJyMlZX?= =?utf-8?Q?233KnQk52I20zrYo0Q=3D?= X-OriginatorOrg: sct-15-20-7784-11-msonline-outlook-95b76.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 7eb6f0d0-7db7-48ae-676d-08dd627e2af4 X-MS-Exchange-CrossTenant-AuthSource: AM8P250MB0170.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Mar 2025 22:26:58.7578 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1P250MB0408 From: bobwei9@hotmail.com (Bob Weinand) --------------yHQqLdxjYiSMQIPQbhxIX52t Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hey Rob, On 13.3.2025 21:46:49, Rob Landers wrote: > On Thu, Mar 13, 2025, at 12:01, Tim Düsterhus wrote: >> Hi >> >> Am 2025-03-12 11:10, schrieb Rob Landers: >> > - Accessing inner classes is done via a new token: ":>" instead of >> > "::". >> >> I don't particularly like that. It is “invented syntax” and I don't >> think that inner classes are sufficiently valuable to dedicate an entire >> operator to them that could serve a more useful purpose in the future. >> It also got 4 negative points in the rating back when the namespace >> separator was decided: https://wiki.php.net/rfc/namespaceseparator >> >> Would `\\` (i.e. two backslashes) work? The outer class for inner >> classes effectively act as a namespace, so it makes sense to me to use >> syntax that is similar to namespaces. >> >> I'll look into the rest when there is a new implementation, since I >> assume some details will still be clarified and fixed as part of >> implementing the proposal. >> >> Best regards >> Tim Düsterhus >> > > I am not particularly attached to the separator. I specifically chose > it due to being a mixture of :: and -> and -: seemed like a bad idea. > In other words, an inner class felt natural to use :> -- however, I > have some issues with it myself. Particularly, it is too much like |> > and as shown in the namespace RFC, way too easy to typo. Personally, > after using it for a few days, I'd almost rather go back to :: ... > > I will give \\ a try, but it has to be typed quite a bit when > referencing inner classes, so keeping it easy to type is a must. I > feel like \\ requires a large movement to type, at least on a qwerty > non-english keyboard. Maybe people using other keyboards can chime in. Please go back to ::. The double colon was perfectly fine, the only thing which was weird was the implicit constant. It's fine for constants and inner classes to share the same name scoping (i.e. a constant must not share a name with an inner class). But an inner class should not be an actual constant. But otherwise, this was perfectly fine. >> I don't think that inner classes are sufficiently valuable > > I'm curious why some people feel this way and why some other people > are saying the opposite (emphatically). I'll nudge the private emails > I've received to speak up publicly on the list as well. But, why do > you feel this way? I don't know why some people feel this way, but at least with the autoloading mechanisms we have in PHP there are definite limitations to multiple classes in one file: - If you deserialize your data structure and it contains another class, whose name does not match the file name, you better hope to god that it has been autoloaded already. Surprising failures in production follow. (e.g.: the amphp\parallel process runner will try to serialize your exception. That's fine. But as soon as it's accidentally bubbling up and as it's not autoloadable, the hell breaks loose.) - Enums or Data Transfer objects specific to one or multiple functions of only this specific class would naturally fit into the same file. But you can't do it ... because the autoloading might try to load the enum first, before the class whose constructor or function you want to call is actually loaded. - Now, if you actually stuff multiple classes / enums into a single file, it's non-trivial to figure out (as the human reader, but obviously for the autoloader too) which file to access to read up the definition of a specific enum (short of using dedicated tooling for it). Certainly, one may say - yeah, just religiously use different files for ... every ... single ... class. But what's the point of that dogma? It definitely doesn't help the organization of dedicated helper structures tied to a single class. It's a tool for organization. It's not complex to understand. Outside of very puristic arguments I don't see any reason why one would not want inner classes. Further, with short classes, should they hopefully be introduced as well, it will become trivial to write shapes for any internal datastructures - simply using a "class Point(int $x, int $y); private Point $pos;" rather than "/** @var list{int, int} */ private array $pos;". This will be a very ergonomic way to reduce ad-hoc arrays which are only typehinted by phpdoc, giving proper typing and also safe access to structures via named accessors rather than [0] and [1] etc. Further Questions on the (original) RFC: - Why is there a conflict in static properties and the inner class name? The former always has a leading $ sigil. - Any particular reason to disallow abstract inner classes? Feels arbitrary. And a note: I consider the inheritance example misguided as "static constructors" (static methods which invoke new()) would be a better pattern here. Could you maybe come up with another example here? Bob --------------yHQqLdxjYiSMQIPQbhxIX52t Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

Hey Rob,

On 13.3.2025 21:46:49, Rob Landers wrote:
On Thu, Mar 13, 2025, at 12:01, Tim Düsterhus wrote:
Hi

Am 2025-03-12 11:10, schrieb Rob Landers:
> - Accessing inner classes is done via a new token: ":>" instead of 
> "::".

I don't particularly like that. It is “invented syntax” and I don't 
think that inner classes are sufficiently valuable to dedicate an entire 
operator to them that could serve a more useful purpose in the future. 
It also got 4 negative points in the rating back when the namespace 

Would `\\` (i.e. two backslashes) work? The outer class for inner 
classes effectively act as a namespace, so it makes sense to me to use 
syntax that is similar to namespaces.

I'll look into the rest when there is a new implementation, since I 
assume some details will still be clarified and fixed as part of 
implementing the proposal.

Best regards
Tim Düsterhus


I am not particularly attached to the separator. I specifically chose it due to being a mixture of :: and -> and -: seemed like a bad idea. In other words, an inner class felt natural to use :> -- however, I have some issues with it myself. Particularly, it is too much like |> and as shown in the namespace RFC, way too easy to typo. Personally, after using it for a few days, I'd almost rather go back to :: ...

I will give \\ a try, but it has to be typed quite a bit when referencing inner classes, so keeping it easy to type is a must. I feel like \\ requires a large movement to type, at least on a qwerty non-english keyboard. Maybe people using other keyboards can chime in.

Please go back to ::. The double colon was perfectly fine, the only thing which was weird was the implicit constant. It's fine for constants and inner classes to share the same name scoping (i.e. a constant must not share a name with an inner class). But an inner class should not be an actual constant.

But otherwise, this was perfectly fine.

I don't think that inner classes are sufficiently valuable

I'm curious why some people feel this way and why some other people are saying the opposite (emphatically). I'll nudge the private emails I've received to speak up publicly on the list as well. But, why do you feel this way?

I don't know why some people feel this way, but at least with the autoloading mechanisms we have in PHP there are definite limitations to multiple classes in one file:
- If you deserialize your data structure and it contains another class, whose name does not match the file name, you better hope to god that it has been autoloaded already. Surprising failures in production follow. (e.g.: the amphp\parallel process runner will try to serialize your exception. That's fine. But as soon as it's accidentally bubbling up and as it's not autoloadable, the hell breaks loose.)
- Enums or Data Transfer objects specific to one or multiple functions of only this specific class would naturally fit into the same file. But you can't do it ... because the autoloading might try to load the enum first, before the class whose constructor or function you want to call is actually loaded.
- Now, if you actually stuff multiple classes / enums into a single file, it's non-trivial to figure out (as the human reader, but obviously for the autoloader too) which file to access to read up the definition of a specific enum (short of using dedicated tooling for it).

Certainly, one may say - yeah, just religiously use different files for ... every ... single ... class.
But what's the point of that dogma?
It definitely doesn't help the organization of dedicated helper structures tied to a single class.
It's a tool for organization. It's not complex to understand.

Outside of very puristic arguments I don't see any reason why one would not want inner classes.

Further, with short classes, should they hopefully be introduced as well, it will become trivial to write shapes for any internal datastructures - simply using a "class Point(int $x, int $y); private Point $pos;" rather than "/** @var list{int, int} */ private array $pos;".
This will be a very ergonomic way to reduce ad-hoc arrays which are only typehinted by phpdoc, giving proper typing and also safe access to structures via named accessors rather than [0] and [1] etc.

Further Questions on the (original) RFC:

- Why is there a conflict in static properties and the inner class name? The former always has a leading $ sigil.

- Any particular reason to disallow abstract inner classes? Feels arbitrary.


And a note: I consider the inheritance example misguided as "static constructors" (static methods which invoke new()) would be a better pattern here. Could you maybe come up with another example here?


Bob

--------------yHQqLdxjYiSMQIPQbhxIX52t--