Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:111415 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 22259 invoked from network); 10 Aug 2020 09:36:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Aug 2020 09:36:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BA3A11804CD for ; Mon, 10 Aug 2020 01:35:15 -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=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Mon, 10 Aug 2020 01:35:15 -0700 (PDT) Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 3C8C910C067; Mon, 10 Aug 2020 09:35:14 +0100 (BST) Date: Mon, 10 Aug 2020 09:35:14 +0100 (BST) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: Theodore Brown cc: Benas IML , Rowan Tommins , PHP Internals List In-Reply-To: Message-ID: References: <20200806091749.64675445@mcmic-probook.opensides.be> , , User-Agent: Alpine 2.23 (DEB 453 2020-06-18) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [PHP-DEV] [RFC] Shorter Attribute Syntax Change RFC 0.2 From: derick@php.net (Derick Rethans) On Fri, 7 Aug 2020, Theodore Brown wrote: > On Fri, Aug 7, 2020 at 6:03 AM Derick Rethans wrote: > > > On Fri, 7 Aug 2020, Theodore Brown wrote: > > > > > Even if we assume the implementation is only about 30 lines, it's > > > still extra complexity that I don't understand the benefit of. I > > > sincerely would like to know what advantage there is of grouped > > > attributes over the `@@` syntax. > > > > It was very *specifically* voted for: > > https://wiki.php.net/rfc/attribute_amendments#group_statement_for_attributes > > It was specifically voted for the `<<>>` syntax, with the explicit > qualification that "This feature would be superseded by any other RFC > getting accepted that changes the syntax." This is exactly what > happened when the Shorter Attribute Syntax RFC was accepted. But there wasn't a *specific* vote to remove that, like there was one to enable it. > > You still haven't addressed any of the deficiencies that the other > > alternatives don't have: > > https://wiki.php.net/rfc/shorter_attribute_syntax_change#proposal > > I'm not sure which deficiencies you mean, but let's briefly go > through the table in the RFC to make sure nothing has been missed: > > - Number of required Characters: > - `@@` has the advantage here. But @@ takes up 94 pixels, whereas #[] only takes up 77 (and @[] 83), so clearly better. > - Has End Delimiter: > - This isn't clearly a pro or a con in itself. But you haven't said why it is better that *not having it* is better. > - Allows Grouping: > - As discussed before, `@@` has the advantage of being equally > concise without this added complexity. I have no idea what that means. > - Forward Compatibility in PHP 7: > - This is at best a temporary benefit of `#[]` which will be > irrelevant in a few years, at worst a source of confusion and bugs > when code intended for PHP 8 runs on PHP 7 with different results. But it helps now, maybe only a little, but it does. > - Breaks BC of valid PHP 7 code: > - All syntaxes but `<<>>` technically have a BC break. There really > should be a separate line in the table for "Breaks useful syntax", > since `#[]` and `@[]` have this deficiency, but `@@` does not. @[] and #[] don't break "useful syntax" either. > > - Used by other language: > - This is listed as an advantage for `#[]` and `<<>>`. However, the table > fails to point out that Hack is migrating away from `<<>>` to `@Attr`. It can only do that because they are removing @ as the shut up operator, which ain't going to happen in PHP. > Furthermore, while `#[]` has the same start/end symbols as Rust, the rest > of the grammar/semantics vary significantly. E.g. these are valid Rust > attributes (see https://doc.rust-lang.org/reference/attributes.html): I've never said that it has the same semantics, only that the syntax is familiar. It still stands that nothing uses @@. > - Familiar with Docblock Usage: > - `@@` has the advantage here once more. @@ isn't used in docblocks. > - Tokens used: > - This isn't clearly a pro or con in itself. [citation required] > - Changes the lexing of **remaining** tokens: > - This is apparently a con for `#[]`. That's why there is @[] now, which is a compromise, something that you don't seem to be interested in caring about. cheers, Derick -- PHP 7.4 Release Manager Host of PHP Internals News: https://phpinternals.news Like Xdebug? Consider supporting me: https://xdebug.org/support https://derickrethans.nl | https://xdebug.org | https://dram.io twitter: @derickr and @xdebug