Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105464 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 801 invoked from network); 26 Apr 2019 18:29:50 -0000 Received: from unknown (HELO NAM02-SN1-obe.outbound.protection.outlook.com) (40.92.5.73) by pb1.pair.com with SMTP; 26 Apr 2019 18:29:50 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1SeDpu5tcRSNluZo6s/Z9aFAq2rAHivGEK6RbTV45nI=; b=k0tK0ls6anzMqJEVIQAsC6nb1C5L+TTMMfzgH1AFA1RxR/QRUx3YXJn4KPrQaXihZP/MfCRDE74zg6Jhgkah4YXXUnMp0D2LiR7nRKpnjuVeHOsT6N4X03EyLq4vawQ3I3OLXiR1Mq7VBzOqhx2DOy1qz+c7gLyD6tRkgIi7rkK3m0x7BGqfhWWNXhZlnS2eIvKNTCSgOdOZKp3314OQPwjyowrMaDDSdQg9hl01myY3fOj3cUK3P3oYF24ThfZzFkqmPNTGD+8iS29u6717ERPirSHExhppFWesk40T6s696nuD2juazL9rJlIVs1jaCgK1aNt7dk8HNaVLvUBZxw== Received: from BL2NAM02FT026.eop-nam02.prod.protection.outlook.com (10.152.76.58) by BL2NAM02HT133.eop-nam02.prod.protection.outlook.com (10.152.76.249) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.25; Fri, 26 Apr 2019 15:31:00 +0000 Received: from DM5PR06MB2857.namprd06.prod.outlook.com (10.152.76.55) by BL2NAM02FT026.mail.protection.outlook.com (10.152.77.156) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.25 via Frontend Transport; Fri, 26 Apr 2019 15:31:00 +0000 Received: from DM5PR06MB2857.namprd06.prod.outlook.com ([fe80::447:30c5:3c4c:5294]) by DM5PR06MB2857.namprd06.prod.outlook.com ([fe80::447:30c5:3c4c:5294%8]) with mapi id 15.20.1835.010; Fri, 26 Apr 2019 15:31:00 +0000 To: Rowan Collins , PHP internals Thread-Topic: [PHP-DEV] Revive Number Format Separator RFC Thread-Index: AQHU+7D7OGXgdVHJp0Ci/FG71ATk06ZNpzIAgAA/dgCAAGMjAIAANcrr Date: Fri, 26 Apr 2019 15:30:59 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:EAAA3C8F961F0A6FEC334598F1618E835F5972885C3D5857B34EE8580E297B85;UpperCasedChecksum:7DD8F3E69C6BD422C3354DFBF088D1763B98881BC82FAB399F9461B1387AD2FE;SizeAsReceived:7033;Count:43 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [8U7nmLxmpcdL+MysuzWHC4cozmE0phUS] x-ms-publictraffictype: Email x-incomingheadercount: 43 x-eopattributedmessage: 0 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(5050001)(7020095)(20181119110)(201702061078)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031323274)(2017031324274)(2017031322404)(1601125500)(1603101475)(1701031045);SRVR:BL2NAM02HT133; x-ms-traffictypediagnostic: BL2NAM02HT133: x-microsoft-antispam-message-info: tR/teUxI4jSDvCfzJujxU9VIV/G1M2t5WaO9/dSrbI3bE7AMG7DLkWp5nG9XkVdQ6cuTYecNDaeovy8caV7J/FDwzF2xD99SJV3dao5tj29YBX+SGq9Ea7DeeC/KVQTvSOnpXL+e09XxUAr5K8LLxmnPmmH0fnPQuioWwQkyVyvClUvu8/Oy5Qhx7tTtqWSZ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 11571e92-332b-4547-8f05-08d6ca5c2f62 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2019 15:30:59.9283 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2NAM02HT133 Subject: Re: [PHP-DEV] Revive Number Format Separator RFC From: theodorejb@outlook.com (Theodore Brown) On Fri, Apr 26, 2019 at 6:10 AM Rowan Collins wro= te:=0A= =0A= > On Thu, Apr 25, 2019 at 6:07 PM Theodore Brown w= rote:=0A= >=0A= > > Is there any chance the Number Format Separator RFC [1] could be revive= d=0A= > > for PHP 7.4? I looked at the discussion from a few years ago and it's= =0A= > > not clear why many people originally voted against it.=0A= >=0A= >=0A= > I'm not particularly against this proposal, but I'm not sure how often I'= d=0A= > use it.=0A= =0A= How often you use numeric separators depends on what you are doing.=0A= I definitely agree that phone numbers and dates are not good use cases,=0A= and that there are usually better ways to write things like the number=0A= of seconds in a day or number of bytes in a gigabyte.=0A= =0A= However, there are many other appropriate uses of large integers=0A= where numeric separators can make the code more readable and=0A= prevent mistakes. Here's an example from code I maintain:=0A= =0A= ```php=0A= function getActiveDirectoryTimestamp(DateTime $date): int=0A= {=0A= // Active Directory stores dates as the number of 100-nanosecond=0A= // intervals since January 1, 1601.=0A= $epochDiff =3D 11_644_473_600;=0A= $secondsAfterADEpoch =3D $date->getTimestamp() + $epochDiff;=0A= return $secondsAfterADEpoch * 10_000_000;=0A= }=0A= ```=0A= =0A= Another common use case is constants used in scientific calculations:=0A= =0A= ```php=0A= const ASTRONOMICAL_UNIT =3D 149_597_870_700;=0A= const SPEED_OF_LIGHT =3D 299_792_458;=0A= =0A= echo 'Time for light to travel from sun to earth: ';=0A= echo (ASTRONOMICAL_UNIT / SPEED_OF_LIGHT) . ' sec.';=0A= ```=0A= =0A= For me personally the most frequent use case is actually in tests,=0A= where various values (e.g. large dollar amounts) are passed to=0A= functions in order to validate business logic. Numeric separators=0A= would help make such unit tests a lot more readable.=0A= =0A= Best regards,=0A= =0A= Theodore Brown=0A=