Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110463 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 60134 invoked from network); 10 Jun 2020 17:07:07 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Jun 2020 17:07:07 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0992C180538 for ; Wed, 10 Jun 2020 08:51:06 -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-ASN: AS8075 40.80.0.0/12 X-Spam-Virus: No X-Envelope-From: Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11olkn2058.outbound.protection.outlook.com [40.92.20.58]) (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 ; Wed, 10 Jun 2020 08:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MvbChQrfsMFpLbxfPNqHppgIIZmC+ZaEQu/Jwvly59BvlsKesOLAEZKSd+2YtpegFuYMk12XqAiURB4a3YklKFTxkl9ZEXCO1jT/ddBdOguhmdA927MhBxU3bIQ1eqemU20oTUFMVRGqeE85VKg+lQfBE2pUMJ7rlK/8ko/9+5vhS5YgClyKF9s/Cfik4PyK78I93/hHKjz+AEZIjZP5KAjdEz7NFTu/rZsAW7kmgbr+UdLrBsr2m+cqecfAw8Sq5d3PSXyNpiHWjo0ERcRfbkgTX9v9R54FV/+GX3Rrv5uFfoZl+VHXGLLNrOuTTg9+kAr+wrdLcljOb/GaggkkRw== 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=jEdN4Gt8k50PCPUyuXWLZ2KgrqfGoxv+OXzijsj6EB8=; b=VYZiLtxzTg0gPto1zdWy10gxSJ2jEW7tVAm8Dg4UULz6+JlCWeU8DdlPZaW5eb6/ElPv7YkYGRmbb7xyigSEXgQVwc1ZZVLgKs5E94RelA69bquW69tQ5H1kFe1FTUqUfMbuXtXn53hoKGqMNUqu8fhzlP/vYmEfEvov8NZ0RbRse0lc2VxVZLpbI4Q88jHwNQ5JhAPihbwJA7iaTN1KtUYs+BvgXTPf1ZB4FRa68aXx7BAxo0sboKSmhQsVakBKDJi4EuBEP1Inth8jwJC/5MA268dwG97oOE1lPsbqX0HFdtCxADaLdzIz8TcicUPaz/3G15IvySR9WPYMN4qSzw== 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=jEdN4Gt8k50PCPUyuXWLZ2KgrqfGoxv+OXzijsj6EB8=; b=YWRFUr1A+QPhzBoKeSRHun9s48IXS1KH8QfosWzKwDPLQQkZl4ZA4B4W19WKLBs8vZ+Jh4iEH+seYus53LTxAsZBWJdFz89dG16TRHbDIkOQhdI+QVMD/jqSJ7QKCW8doZ8WUorm7UNCn7c2rVW3zTk8i8/euPsqLBMvIBaID6YWA10vaBJQ7SCXPIoA9R1c0Rj43vhpvckH4GU5x5QeCz3b255C8Fo+ygFg4EJzViZMDRDg7YyN6KMUKkXt54zFfcOklCJV3FjuGX85orCJ5GI2xLPLlppZXrkYTTljykU58IDOGuEB0rjOO4Lzf+3E+8nkkz9bPCz5c3NruGsnrg== Received: from BN8NAM11FT015.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::4b) by BN8NAM11HT167.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4b::244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18; Wed, 10 Jun 2020 15:51:04 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com (2a01:111:e400:fc4b::4a) by BN8NAM11FT015.mail.protection.outlook.com (2a01:111:e400:fc4b::90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3088.18 via Frontend Transport; Wed, 10 Jun 2020 15:51:04 +0000 Received: from BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::54e2:1eeb:fc5d:8c21]) by BYAPR05MB6535.namprd05.prod.outlook.com ([fe80::54e2:1eeb:fc5d:8c21%3]) with mapi id 15.20.3088.018; Wed, 10 Jun 2020 15:51:04 +0000 To: =?iso-8859-2?Q?Micha=B3_Brzuchalski?= , Benjamin Eberlei CC: Sara Golemon , "carusogabriel34@gmail.com" , internals Thread-Topic: [PHP-DEV] [RFC] Shorter attribute syntax Thread-Index: AQHWOgIv0rCwDWp4oECJgOMrWx9MxKjQNb8AgAFTugCAAIAn3w== Date: Wed, 10 Jun 2020 15:51:03 +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:95DC86763EA4D204684A5CA673FA275C26A33F8C6DCC3F1A73D0D9F5DEE42AD4;UpperCasedChecksum:B0B6551925DDA8B226FF32D065BA3C61E28FCB261A79A4AEDA6B8C1E1860BD13;SizeAsReceived:7229;Count:45 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [mADt6pILHMwSY52XqHlzE+ArG/as7PfI] x-ms-publictraffictype: Email x-incomingheadercount: 45 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 2ba16873-24d2-458d-11ee-08d80d5614dc x-ms-traffictypediagnostic: BN8NAM11HT167: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: L66VwFf4jf/LFWwi59J06Xyr3JLBtZqD4ip4k4ct3OrNeBPswyCuVCR1oqW1Jk+qlH5FRPzVCKiBwcquUe6+LhjH0mKd2338BE0sXjF+iiFS0F7ZOMCKhCQSBiIWnrUt3R2ziBRIoX5bhjZBHabF9948jKEBPKoFF6Ikze90FwdelLrnAMxZARyhqE6VQy91XB3SIcbMI6+fyLh3ngKpzg== 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;SFTY:;SFS:;DIR:OUT;SFP:1901; x-ms-exchange-antispam-messagedata: bPXJ+mZGGA6ipYOXjoL8v8/Q4WEIWEXNkBV4J8pdXQN2WBFly0STgM817tSRTUyOxwNOzg2XiPNPZ7ip5Ms40iZNDNTOiWoxEoR+oQg3UrHUExahSDe795pyljQtZ82Ozc6HhaYAk11Hc+OkpQnrrw== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="iso-8859-2" 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: 2ba16873-24d2-458d-11ee-08d80d5614dc X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jun 2020 15:51:04.0021 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8NAM11HT167 Subject: Re: [PHP-DEV] [RFC] Shorter attribute syntax From: theodorejb@outlook.com (Theodore Brown) On Wed, June 10, 2020 at 3:11 AM Micha=B3 Brzuchalski wrote:=0A= =0A= > I just noticed a power of Rusts outer attributes which this syntax=0A= > count follow in a future. Following outer attributes in Rust's we=0A= > could introduce in a future syntax like=0A= > =0A= > #![StrictTypes,Module("my_module"),Opcache(save_comments: true)]=0A= >=0A= > The last one used with recently proposed named arguments which could=0A= > open a wide range of possibilities IMO. In Rust adding exclamation=0A= > mark after hash `#!` imposes to take effect on the outer scope which=0A= > inside a file would be the whole file.=0A= > =0A= > Going that path solution like that could possibly supersede=0A= > `declare` statement in a future and allow to add compile-time=0A= > attributes without breaking the language. I believe this is very=0A= > important because any attribute which is not declared as a core and=0A= > built-in is not taking an effect. This way it'd be possible to add=0A= > new ones in future PHP versions. Even more with `zend_ast_process`=0A= > it'd be possible to implement core attributes which take effect on=0A= > whole file in extension.=0A= > =0A= > I can imagine this can possibly be discussed to allow attributes for=0A= > eg. from ctor to take effect on class but am not 100% sure of it is=0A= > useful.=0A= =0A= Hi Micha=B3,=0A= =0A= I'm really not certain it's a good thing to have another way of adding=0A= declares which would be ignored in older PHP versions. For instance,=0A= in your example if the code is designed to work with stricter types,=0A= what happens if it's unexpectedly run on an older version of PHP?=0A= Instead of erroring as it should, the code might keep running but=0A= produce unexpected results for certain inputs.=0A= =0A= > Going further with my imagination if we go that path with `#[Attribute]` = =0A= > we may think of adding error suppression.=0A= > I know many don't like error-suppression but sometimes it's helpfull.=0A= >=0A= > In case of core attributes I can imagine a const value can be added=0A= > renamed or removed, but the attribute remains the same then adding=0A= > error suppression in a future allows to avoid crashing like for eg.=0A= > =0A= > #@[Jit(Jit::OPTIMISE_SOMETHING)] // where the const may exists or not= , but the Jit attribute does=0A= > function foo () {}=0A= > =0A= > In those cases we don't wanna crash the program, we may want it to=0A= > continue rather without proper optimisation then not at all.=0A= > =0A= > I just see another use of current error-suppression operator @ to=0A= > play nice with attributes.=0A= =0A= Please, let's not add a new place where error suppression can be used.=0A= Yes, it's necessary when wrapping some old APIs that otherwise output=0A= warnings, but for new APIs I really don't think this is a good idea.=0A= =0A= Best regards, =0A= Theodore=