Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108757 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 16132 invoked from network); 25 Feb 2020 19:59:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Feb 2020 19:59:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E7901180561 for ; Tue, 25 Feb 2020 10:16:46 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS8075 40.64.0.0/10 X-Spam-Virus: No X-Envelope-From: Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12olkn2010.outbound.protection.outlook.com [40.92.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 25 Feb 2020 10:16:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N7aWGs+d3bjW5j/6ciwch14mcVk+ssOuesGbzM2TGbzMZQ0O7vDBnv4JOxHXtTnBKKUm4ETmucxCdcDFA5dzia9ZC5CsoVi0s830MpyAlu241i2tZ/75/VT/uWX8w25fZ+ttmG1ztDSGsXY8JTYQ8l2ecTuiis1klZPBEPlL1aIeyeq/8U4uyN2SYamOYz+8doKMk9hpvPuq6g2Q2oLn8QExkpVBTo7juFRGP5M11Ti8jCgOvK+WMXTV3fJNLALymSMJcYXKHgPhEX7pvY/BQlchu4LQG0EHy2igEwacVBVfYsywrd9qNqx7jHROjobfpk6UWEmh30CRbVtDxb8ZiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZGLJHIdxfSY97znzUwHa7Wd/eC4TwWN4jT0OR9SeSgA=; b=Vhv8KX3EyTZwHRcRerVmfR9YOOG2h4MTPFz+xLUVveHUeCIaqwfxEhpevpP8CcT6ywRSxkMq5IqgMjsZ3JoFIOHAHvXipBfbvLiRCiILedmnI6y34n2kfS8ZZboT/7tkDwF6adQdGgqcgHjZGPCzNyuz9YGoRd+Q7EDPnGRSFpO2IrIGqEIx9o6y/xaeKWqBAW/viSJSU/VL2VzXmEEcgzV2XJ9n34HeTbCoaEoaJQcp+7NicCqeA3CcJtFfG0EgAyi7u0L/jI+7VzpUr+DCenTsr+Ee0PynBXdhT/3wmZAusKW34e6S8o6hBwb81ThMSBH0qrZTxkkaz38l/GWbsQ== 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=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZGLJHIdxfSY97znzUwHa7Wd/eC4TwWN4jT0OR9SeSgA=; b=XMMmA6Z7Gpm1dBSpywkjDsilCynAZDV+yCueT3CFBSRTyVMfxY4e+BY40/G6XGOA1866qaIwHSrFbevRsvUmYsXtngUplXNac9nybZ2/Y1zvBttmHOslC8nqgk1IkuRg1bAeRSjayaMSlf3ITn/KuPKGo01Lcl++Kiex4PjKGVdY0j63xtSzQ+Q1cTkL4yinohcJ5u7/LqC556i0qdE2kV181M9AdBLg3MEUHnpEY8n3X7B9wJYXqKwuOAZf7UbkEn5Qfn3KCPeoYnhE6olNQVFw8ZlNhsaBm++OCUYA6UPK74br2m08P2tdTE2yv88hNz+yFpaPwmfoCV6yX4LwDQ== Received: from BN8NAM12FT033.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::34) by BN8NAM12HT251.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc66::259) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.6; Tue, 25 Feb 2020 18:16:44 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:fc66::39) by BN8NAM12FT033.mail.protection.outlook.com (2a01:111:e400:fc66::107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.6 via Frontend Transport; Tue, 25 Feb 2020 18:16:44 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::809d:f76b:7645:d537]) by BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::809d:f76b:7645:d537%2]) with mapi id 15.20.2772.012; Tue, 25 Feb 2020 18:16:44 +0000 To: Nikita Popov , php internals Thread-Topic: [PHP-DEV] Re: [RFC] token_get_all() TOKEN_AS_OBJECT mode Thread-Index: AQHV6/SkmScWAT9IOU2mzWi+UuUzTKgsJ0e/ Date: Tue, 25 Feb 2020 18:16:44 +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:68F759CAB9AC8B5711D9E79AFD7F951EAE3D0C88EDBDE7FB41F0F8C354F35EBF;UpperCasedChecksum:0AF69C971078751D5393CB42DD5A347123564BFE44CB626897961113E7A18FEF;SizeAsReceived:7051;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [J+QzQnajeHuxt+iG4sV29JaNvG+iKOvI] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: a9799bb3-7021-418d-5f2c-08d7ba1edee7 x-ms-traffictypediagnostic: BN8NAM12HT251: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: zKxlQBcTz/PY+vXUKcrooYvEtElCpqrYAih4kwfGgtEybN8hOpkuVX8Ub3DYdayDRhowmP4BA6zMXc7cvlSNLMU3qjK08mggste/jtG/iLdERG8o1BR8ZSdfsVTpzyO7A4WkrdNIAQxEdMsj2J+BhSAIj5LkEwwoy618p9JJyKx8ENrs4qiynVAqa8yah/8ASO3f7vtooK1snwoC+idk2/gpZBEklyXtPV3A42weS5w= x-ms-exchange-antispam-messagedata: 7PcUQ2IP7bPs+n4n+Fhl7O+p4Q2Dd+fInuJ3QOwXhKTLGOiAg5ktDiht8aDqmm8dVPEcsPbWsMQ7tl6sa5PUytuOjhq1jBBZKPaPizpYcdrVDaUwsPIUjS19VgPKLEb8mAkG/OoQ6wdklr41GltF1w== x-ms-exchange-transport-forked: True 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: a9799bb3-7021-418d-5f2c-08d7ba1edee7 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Feb 2020 18:16:44.6695 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM12HT251 Subject: Re: [PHP-DEV] Re: [RFC] token_get_all() TOKEN_AS_OBJECT mode From: theodorejb@outlook.com (Theodore Brown) On Tue, Feb 25, 2020 at 9:59 AM Nikita Popov wrote:= =0A= =0A= > On Thu, Feb 13, 2020 at 10:47 AM Nikita Popov wrot= e:=0A= >=0A= > > This has been discussed a while ago already, now as a proper proposal:= =0A= > > https://wiki.php.net/rfc/token_as_object=0A= > >=0A= > > An open question is whether (at least to start with) PhpToken should be= =0A= > > just a data container, or whether we want to add some helper methods to= it.=0A= > > If this generates too much bikeshed, I'll drop methods from the proposa= l.=0A= >=0A= > I think this proposal is in a pretty decent shape now, and I'd like to mo= ve=0A= > it to voting soon. The only remaining open question is whether we want to= =0A= > add any additional predefined methods. As the class can now be extended,= =0A= > every library can add their own methods, but there might still be value i= n=0A= > providing some things by default, primarily for performance reason. For= =0A= > example, the proposed is() method can be a good bit more efficient when= =0A= > implemented directly in extension code.=0A= >=0A= > Any feedback on this point?=0A= =0A= Hi Nikita,=0A= =0A= Thanks for this RFC. The proposed `PhpToken` class will definitely make it= =0A= easier to work with parsed tokens (I struggled with this when working on=0A= the migration script for deprecated alternate array/string offset syntax).= =0A= =0A= In regards to the open question of additional methods, the `getTokenName()`= =0A= method would be very welcome. `isIgnorable()` would also be helpful=0A= sometimes, though I don't care much one way or another if it's added.=0A= =0A= But I'm really skeptical about the value of the `is($kind)` method. Code=0A= working with tokens should know the type of value being checked (ID int,=0A= text content, or array of one or the other), and a method that accepts=0A= any of three types can make it harder to understand what's going on.=0A= =0A= For example, the proposed `isIgnorable()` method doesn't need to use=0A= `is()`, it could just check whether the `id` property is in the array=0A= of token constants.=0A= =0A= Best regards,=0A= Theodore=0A=