Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108941 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 39812 invoked from network); 10 Mar 2020 13:16:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Mar 2020 13:16:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3D1CF1804D3 for ; Tue, 10 Mar 2020 04:37: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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 10 Mar 2020 04:37:14 -0700 (PDT) Received: by mail-io1-f45.google.com with SMTP id d15so12397158iog.3 for ; Tue, 10 Mar 2020 04:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=5GIzubGZwNXHh2IerpONkqYp9WfJYYB8qvj0W9P6f2Q=; b=iNmhy2YL7ALitZu1/F/wsdqNiWPHF7Ui7hJu9W8e2ww4RnB1LqosknIJgAd80urC4K GyAnotHvpzIj/5szfcUaayfu5nUo785+CinMkMa0lXbYw0ME3C+/Be3ZXIgrh0mGCCxm bNb6FGEruraogKm1YHX9qcLsKfH9nD/a/d+G+u+QBqWBWdBHhggV0N2BZ58ctaA46VRQ IFvTbdoum4AZdDfaPXT2u+5vzA/PJBhu1E4ScQ+ZSSJhdhPlECkph9kW1kUFIPAZe0Cy ZvUc551bQwZocmmMUUl+swm6Hn/XQeLxpZAP+C+qy+jHb1YUQiCCYaTiW1Yp4Ew+ze1N eZ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=5GIzubGZwNXHh2IerpONkqYp9WfJYYB8qvj0W9P6f2Q=; b=o38BWGet3zFVNU8s/pGbMEnPTm4lIsWNvg7Qy94Q7YWMAzOAH2DSSOBhhweD8xjwUB 9sI5Ma/LMrprdAoOrUD5Z86RHwH7E1kTn7cYg4O2bjyDJax+7qwakROPmqX0iYoMd9j8 f0DQnqHMvY6m13trZVUHjP3SJxy1hB2vcKYS1JgADA0bc+S64qPDA24IJLz0Kg8hPjx0 xlOVAk81iMloKmmSBdAz7ER3Uit2A/3yFgYwJNxgbzqJCUFZbeN4XHOK3GCXAkoej/8S U12Yqe5Y7APZ4kUhpsI+CMhw1DIhrrt+fSYhsdm1fxwqm6/YCBE1HUctasJq74+asF5K MxxA== X-Gm-Message-State: ANhLgQ3NVQQgVT8JXeN3NyoveLrvh4XmlwwwOkht/BuufPA9oZKordgU hvZewdKlG9IVXKOIH0YEud9vi4Vz8pxNu4X+p97tTA== X-Google-Smtp-Source: ADFU+vslEjGU04cbJbDMbW6pu0QlbMcZbcSUyeo2gawU7x78wazFlnzVschHXyqz2Uu8jPFUIK64I9+iTC06hHFuDx4= X-Received: by 2002:a6b:4906:: with SMTP id u6mr17464972iob.120.1583840230772; Tue, 10 Mar 2020 04:37:10 -0700 (PDT) MIME-Version: 1.0 References: <2227A758-3035-4A43-974C-C4461A096DFB@newclarity.net> In-Reply-To: Date: Tue, 10 Mar 2020 11:36:59 +0000 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="00000000000056147f05a07e8a63" Subject: Re: [PHP-DEV] [RFC] Attributes v2 From: rowan.collins@gmail.com (Rowan Tommins) --00000000000056147f05a07e8a63 Content-Type: text/plain; charset="UTF-8" On Tue, 10 Mar 2020 at 10:54, Rowan Tommins wrote: > > C#: [Foo] > Rust: #![Foo] or #[Foo] > C++: [[Foo]] > Java: @Foo > ECMAScript (proposed): @Foo > Go: `Foo` or "Foo" > Doctrine et al: /** @Foo */ > Hack: <> > > To add to that list, Python decorators, which serve a similar purpose, also use @Foo, and in confirming that I came upon some interesting discussions of how they came to that syntax in https://www.python.org/dev/peps/pep-0318/ and a long list of alternative proposals at https://wiki.python.org/moin/PythonDecorators There was apparently an alternative proposal for a "using" keyword, but it was ultimately rejected in favour of the punctuation form. Not all of the considerations apply to the PHP case, but this quote from Guido is rather interesting: > The keyword starting the line that heads a block draws a lot of attention to it. > This is true for "if", "while", "for", "try", "def" and "class". But the "using" keyword (or any other keyword in its place) > doesn't deserve that attention; the emphasis should be on the decorator or decorators inside the suite, > since those are the important modifiers to the function definition that follows. > When a function definition carries one or more decorators, the most important information > is not the fact that it has decorators, but the specific decorators used. I think that applies to our case equally: any punctuation or keyword is just a separator between the main function declaration and the specific attribute being applied. Having to write "attribute Sealed" would be like having to write "visibility public"; as much as possible, we want "Sealed" to be the keyword, and the rest of the syntax to just be formatting. Regards, -- Rowan Tommins [IMSoP] --00000000000056147f05a07e8a63--