Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108946 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68369 invoked from network); 10 Mar 2020 14:12:30 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Mar 2020 14:12:30 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4A2871804D3 for ; Tue, 10 Mar 2020 05:33:24 -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-il1-f178.google.com (mail-il1-f178.google.com [209.85.166.178]) (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 05:33:23 -0700 (PDT) Received: by mail-il1-f178.google.com with SMTP id o18so11767129ilg.10 for ; Tue, 10 Mar 2020 05:33:23 -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=M09DYg4bWLftArJr1VUKBbPqV2VrNuwaFXxDObdS1dY=; b=LrZb8yv219Noh6zKzQ2szyotfHRRUF15UPjvIcpIO+3HyXHn6Qqvcl+R47gIUANHlf QPTI4cUeDTEVvCdm2cdsuagU7d51Aqg4zrr+AlwzJvlDBbjXD33UF7Cx4bLZzQbuz6FG 9Q4BqyqqDnKM5hhGBwa1iORxOBuhvlKuvcrjntktcZ19BXC+iMRpzSwqWf+RaRefuW5a VFzqjCqxT93nbj6XjbUsPqUHsHhPzCk+lk9pwXJTSdVwXluZp4JeKYRdouxAJalPKUbN 7OeNekNPlyzQwNYISfsng58oJVtPK8YtNBXt+blZg2NJ0oTVD//+3JNDtNIlcgzK/0k1 EeZQ== 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=M09DYg4bWLftArJr1VUKBbPqV2VrNuwaFXxDObdS1dY=; b=I90+B8wpwZt3slS9vV1av31zC100RFQr3xnwHlPCERawsccTklytwUJNMQr9HqFfpW GcgJKrETQIC98XgpOyjfAjH39VIlMe6mmADuufjXnTCmTGkTOyxVgdq58uf0UZ6lCIMc cisblKcbaN92ahcFmKN9Hlbko041Nnw+XL1dtecJTr+oMXxIFcwPxWErjI/dZ81tDgrI JWa7I0TNSmjnjdezQj2zQN0x5Jk0ZIBePe/nwu2BBJzrWrM3gtUv6kpFT/6ZHcYq9Rp0 KXD2gPDB40fTU74hDBPn6/Bm+IQGldzs7A9iHrczFcNAGYKOKspj/GBa5uqo3lDWh/iN 1EXw== X-Gm-Message-State: ANhLgQ0IV0j8rhd7BcStWnxhyxthm4g6/Xnb4xSICkgpyqD5j0PaMNto AB30zhPlCYzdlGBGKJmE4moG80mJ7ot39rX8XMtjsl3G X-Google-Smtp-Source: ADFU+vsEycHQQ8nyEXQnxHCrsCRhKerFbfQXIGtV3JTVHLq34Fx1e/zXBSgzYUeVSMWpQkPS3RwyuwEllPGZ8AQgM50= X-Received: by 2002:a92:d702:: with SMTP id m2mr19212760iln.149.1583843600268; Tue, 10 Mar 2020 05:33:20 -0700 (PDT) MIME-Version: 1.0 References: <2227A758-3035-4A43-974C-C4461A096DFB@newclarity.net> <3E1ABF22-ACB5-4952-AE11-F842D76F8B4C@newclarity.net> In-Reply-To: <3E1ABF22-ACB5-4952-AE11-F842D76F8B4C@newclarity.net> Date: Tue, 10 Mar 2020 12:33:09 +0000 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary="0000000000002c822305a07f538b" Subject: Re: [PHP-DEV] [RFC] Attributes v2 From: rowan.collins@gmail.com (Rowan Tommins) --0000000000002c822305a07f538b Content-Type: text/plain; charset="UTF-8" On Tue, 10 Mar 2020 at 11:46, Mike Schinkel wrote: > > On Mar 10, 2020, at 7:36 AM, Rowan Tommins > wrote: > > 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. > > No, you are making a flawed comparison. > > There are only three (3) visibility modifiers in PHP whereas there are > practically *infinite* potential attribute classes. > Yes, it's a slight exaggeration, I was just trying to expand on the quote from Guido van Rossum; you can read his full response here: https://mail.python.org/pipermail/python-dev/2004-September/048518.html His example actually uses the infinite variety of decorators as a reason to minimise the syntax: > A classmethod or staticmethod decorator adds a completely different flavor than a decorator that provides an > external linkage hint for ObjC, or one that adds synchronization, or one that declares deprecation. Anyway, the main reason I linked the Python discussion was to see what talking points were raised, and that was pulled out in the PEP and I thought was interesting. > > That doesn't mean PHP couldn't buck the trend and use a keyword instead, > > but we'd need a strong reason to do so. > Clarity? Readability? Ease of learning? Sure, if people agree it provides those things. I personally don't, but that's fine, not everyone's going to agree. > Consistency with other declarations in PHP? I think this is generally a weak argument, because we have a mixture of punctuation and keywords already. We use { and } to denote blocks, not begin and end keywords; we keep on adding operators because people prefer them over function syntax; and the biggest complaint with the lambda syntax was that people wanted to *remove* the "fn" keyword. You mention properties as not having sigils, but we don't have a "property" keyword either; we have an optional "var", but I'm not clear why that was un-deprecated, because the syntax "visibility $name" is always sufficient. And although we write "class Foo extends Bar" where other languages would have "class Foo: Bar", we write "function foo(): Bar" rather than "function foo() returns Bar", and there are people who would prefer to write "public foo() {}" rather than "public function foo() {}". I think it makes more sense to evaluate the syntax *for this specific case*, rather than trying to compare it to other decisions we've made in the past. > Just because other languages did it that way? That seems like it is just a bandwagon justification, not a justification based on evaluation of available options. We should learn from other languages rather than blindly copying them, but it's interesting that I've yet to see one which adopted a keyword-based approach. That means either: * They didn't even consider a keyword approach * They considered a keyword approach, but rejected it for reasons that don't apply to PHP * They considered a keyword approach, but rejected it for reasons that we should at least consider Before we go down the path of being the one language which does it differently, we should at least examine which of those is the case. Regards, -- Rowan Tommins [IMSoP] --0000000000002c822305a07f538b--