Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111584 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 75957 invoked from network); 17 Aug 2020 16:13:57 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Aug 2020 16:13:57 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id C5665180510 for ; Mon, 17 Aug 2020 08:14:53 -0700 (PDT) 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,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-oln040092009022.outbound.protection.outlook.com [40.92.9.22]) (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 ; Mon, 17 Aug 2020 08:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LVIGCogH4BEqmRUO9rxCuFhXAQqk06N8P/7UgN4aCAoQ2GVa8KJSuizRjrkczt73EZtpK4Yxw+vUDuVki109EGOm1FtbuUpefDr313EPo6M14jWScCYHSexyA2nMLUvSmKgyAn/X1Dj6Q0cmu27xTOwL93n/QtTACX5tMlfUVPA8pxt0x69isWNulFHHXSCk80+NFDs2sgQEI53mN7WpeyrgDatnikRPy48IkOrclNcuIyd7HiTVAOPTCad+SYZDBglkWTxztcW1YTRQMkCCVAHnMHl9uiiHN8QQIXRip//yn90l1RTiuYmflX+xXxRKyqjCy8rKwlLOuLNQ4BiOiQ== 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=VWTWiZQoqdb+k40EUPHh2tEluDtIoKekoecrHl8oj38=; b=YhlMM5527oLJpg0ZCVjVKxmX4cTWnbXBEGeExd1R1CWhNefyrj0wE16v98nh3vKJgSWsS5UJQEbCwNsQCHThdh9d04QIKFnLKRoPrc65jhMgtyBSWiDIMO748XHmY+rmoGt/Dy55O6ypKeZ0PhLflS/OpI07t4pYuJS2ICRHwfwcLbSHVuuUzzEpv5i62fPIV73Nge0hzOkUHrwq7r3DUs81haZ46q2ru+gQEe89CMeD60eD/0/inIVg3pIVRbTjriG1wsGPbxFHAO+Y/uCjoC/Za+uyBL//7deUvgVB7qPAQ2+n98vZETcow233juBCbxV6QimR/7hAJ1D/T4VMlQ== 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=VWTWiZQoqdb+k40EUPHh2tEluDtIoKekoecrHl8oj38=; b=b27VfWdhgOB5+t8E14MaoEkrGEa2XdaL2yZBpImZjmNgz1dULgdQnQ3drfEAdQVuU4aN0pNywcnecX18cIRdEJpwJf8koPk/QDQqbrL8Yo9YUkxRh7BfJZCoUPE6OljCGlDeKnOviA91fjao/sBb7m020SOwIKfoETd8ZF1o7HzHywkhJ2UdyRSJQMoQPBPBrTJpV7YhjVmAfSlhS34lTf1fFSXbdy2iWnlNywVHb7/kh1jmixAx6M/v61ukqzKcRk8clxGnByiEpzykcggxdfxxCvLwiQS2WZ3zGdubBt5rQtc90HJii9SlEkru4byNq56WeQIIazFLp2arypia1g== Received: from BN3NAM04FT013.eop-NAM04.prod.protection.outlook.com (10.152.92.56) by BN3NAM04HT177.eop-NAM04.prod.protection.outlook.com (10.152.93.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16; Mon, 17 Aug 2020 15:14:51 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:7e4e::43) by BN3NAM04FT013.mail.protection.outlook.com (2a01:111:e400:7e4e::152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Mon, 17 Aug 2020 15:14:51 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::fc6c:38b0:fa18:f355]) by BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::fc6c:38b0:fa18:f355%7]) with mapi id 15.20.3305.023; Mon, 17 Aug 2020 15:14:51 +0000 To: Benjamin Eberlei CC: Derick Rethans , PHP Developers Mailing List Thread-Topic: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 Thread-Index: AQHWamWKUBRwNDrYsUOzfoBQKi8o6Kk6jJOAgAEDLLaAALqdAIAADgONgAAfNXw= Date: Mon, 17 Aug 2020 15:14:51 +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:8A01D2CDE6A912B84832B7EC537A5F13018262C2EBDF1BCD83B67337DFAEE62F;UpperCasedChecksum:D9EEF9AEEAFDB20284C25728229ECDC844253AEB97BD1B1360D7A213AFB1B95A;SizeAsReceived:7330;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [rEkTw+2GfEz3w2AajD24lDLwgzKbeXxQ] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 24ed0a33-3eb4-4c29-9520-08d842c04a06 x-ms-traffictypediagnostic: BN3NAM04HT177: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9m0Vb5T+l+BTpo2SRTOXxNO2Efjt7fo7YKSO3bCwzL9GeocQjgHA5mCmbxDNjpvhBVGkxIy1XJoLN8bycPCFB04pzNRcOdDB/Hp4FJUL5G5Xe9buIJTiZOGjjXkEstmJbSF01JyT/MXJADVuL9v33qcNvUjEm1fpXvi9mnj6QDMyFMXlhjiF7+Tb9dIHHqYhdJMZJx6QabHQgk6FiN8bsw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR05MB6535.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: pAbHkr/Sa72SbuYavw0OeRRzctexHkP/G5OOiz5D3kQzjASscF/307ZkAYWsP8VWf0P6iOuISacNG8QEjUX4ucqbw/wOFJN6sBw8ZwbECUpU6QBqpCGCaa5teZUyCgdi6ul5g1cVVv2Dgp7N83cO4Q== 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-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: BN3NAM04FT013.eop-NAM04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 24ed0a33-3eb4-4c29-9520-08d842c04a06 X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2020 15:14:51.5454 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3NAM04HT177 Subject: Re: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 From: theodorejb@outlook.com (Theodore Brown) On Mon, Aug 17, 2020 at 8:07 AM Theodore Brown wro= te:=0A= =0A= > On Mon, Aug 17, 2020 at 7:11 AM Benjamin Eberlei wr= ote:=0A= > > On Mon, Aug 17, 2020 at 3:06 AM Theodore Brown = wrote:=0A= > > > ## Potential Future Benefits of Enclosed Delimiter Syntax?=0A= > > >=0A= > > > The RFC shows an example of a potential "simpler" attribute using a= =0A= > > > string instead of a class name. I honestly have no idea what this is= =0A= > > > supposed to do or what benefit it would have over normal attributes.= =0A= > > >=0A= > > > The concept of attributes being a class name with optional arguments= =0A= > > > has been proven over many years by its use in docblock annotations,= =0A= > > > and if there was some deficiency in what this syntax allows it seems= =0A= > > > like we would have discovered it by now.=0A= > >=0A= > > I agree on just the string, but a closure would make 100% sense for=0A= > > a decorating feature. Javascript and Python "Attributes" work as=0A= > > decorators, i.e. they get called around the decorated function.=0A= > >=0A= > > It is not a completely unrealistic feature to think off:=0A= > >=0A= > > @[fn($x) =3D> syslog(LOG_INFO, "Called function foo with x: " . $x)]=0A= > > function foo($message) {}=0A= > =0A= > As I understand it JavaScript decorators do not use anonymous=0A= > functions for decorators like this, though. Instead you would make a=0A= > named function and apply it with `@myFunc()` before the decorated=0A= > function or class.=0A= > =0A= > Presumably we could accomplish the same thing in PHP with e.g. an=0A= > `__invoke` method in the attribute class, without complicating the=0A= > attribute syntax itself.=0A= =0A= One other thought on this. I agree that decorators are not a=0A= completely unrealistic future feature. However, it must be noted that=0A= both JavaScript and Python use the `@Attr` syntax for decorators, and=0A= the lack of an end delimiter in no way precludes this usage.=0A= =0A= The whole point of a decorator is to offer syntax sugar for a common=0A= reusable pattern (pass a function/class to another function which can=0A= add additional information or behavior to it). It's not clear how an=0A= anonymous closure would be useful for this, since it would not allow=0A= reusability, which defeats the purpose.=0A= =0A= So the argument that an end delimiter has "potential future benefits"=0A= still lacks any realistic examples, and is countered by years of=0A= proven usage of the `@Attr` syntax in docblocks and other languages.=0A= =0A= Sincerely, =0A= Theodore=