Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:108957 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 44848 invoked from network); 10 Mar 2020 18:06:55 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 10 Mar 2020 18:06:55 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id A6D5B1804D0 for ; Tue, 10 Mar 2020 09:27:49 -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.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE 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-yw1-f47.google.com (mail-yw1-f47.google.com [209.85.161.47]) (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 09:27:48 -0700 (PDT) Received: by mail-yw1-f47.google.com with SMTP id i1so9944061ywf.4 for ; Tue, 10 Mar 2020 09:27:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JmW/0noDrNArD3nc7jaHp/KN606Q4wHFAW6GmzGzTgY=; b=tL4fcLQ7zJ83kr/dmpK0By8RUngS/HK3JqYRFc1aLbz5enZDkTYt3zORuN2swDRqt+ 19Fa0JLdsoaXkeUwq8r6VDXKW7WcPefFIh0x9Sl56Tff+FiNKoxA2YE1xMpPUWc+M9T/ Mx6kWrYA3zFwwv5wTpTrjD7DSHif9Th15Hbg3q9+F9c6XU3OKG4YAvMBesZ6CuBavbRV 8FVG+3ieqJwpALmFjYPzUW1d+2ixjxri4yahKyjFLElEdoiS+352KdopcYA5F2u5mFkj B6k/6jXZRKrIsZDC3wu1py4E4JfCXJnk5CVJME8NL7sKpzFwv+E5MGGRn/cZD6JNw/T9 4QnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=JmW/0noDrNArD3nc7jaHp/KN606Q4wHFAW6GmzGzTgY=; b=aNkFN6JvuzlNxvZGmSMKpaRYPAiuferEMhcKijJh38V3tAr20uX6MsoGZ666F01bXi oaNPdhW5U0Z6YWbdExmwXQlmuL4t6/z6rJ49FPdWU8pD+I42LiMQMTAnnZCMWkwWq6FL +ktESTbABR2J0JX6lQ/A6VO3RdBU0WUaCRNSPveuhHvYVdBRw4EcD+wqw3WZxwpLsrxD MypdyL0wUjNv4JFxVkbr6b26eIqfdLKng/PDIUp315kTcaBKeHErDetsl7hHjNsF/Q1y OJlJecvTd79xgNB9wM+ei+hDIHYEBZlZTwPaHVmT3csOrtrOWFFL9ERmac7p7SEl21ve F1Cg== X-Gm-Message-State: ANhLgQ3lz7Ycw+cFcYUK/I0+B+J0Qm0KotzsVRCcLms5w7uohfmvD1cT PxSUibW+C00Ls8xyTaZ3HCd1jw== X-Google-Smtp-Source: ADFU+vvcJCOVgkUT06krndOk4hNqlMgIFDzKTh7c2ejcKjFGZGGS0SL6otsp9NgJB7X+a4z6y/ROWg== X-Received: by 2002:a81:36cf:: with SMTP id d198mr11052173ywa.177.1583857668113; Tue, 10 Mar 2020 09:27:48 -0700 (PDT) Received: from ?IPv6:2601:c0:c680:5cc0:8dba:c229:7c5e:3d05? ([2601:c0:c680:5cc0:8dba:c229:7c5e:3d05]) by smtp.gmail.com with ESMTPSA id x18sm12668829ywg.19.2020.03.10.09.27.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Mar 2020 09:27:47 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) In-Reply-To: Date: Tue, 10 Mar 2020 12:27:46 -0400 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: References: <2227A758-3035-4A43-974C-C4461A096DFB@newclarity.net> <3E1ABF22-ACB5-4952-AE11-F842D76F8B4C@newclarity.net> To: Rowan Tommins X-Mailer: Apple Mail (2.3445.104.11) Subject: Re: [PHP-DEV] [RFC] Attributes v2 From: mike@newclarity.net (Mike Schinkel) > On Mar 10, 2020, at 8:33 AM, Rowan Tommins = wrote: You make it really hard to just let the discussion just stand. >> Consistency with other declarations in PHP? >=20 > I think this is generally a weak argument, because we have a mixture = of > punctuation and keywords already. Saying it is a weak argument is merely opinion. You are grasping for = reasons to claim that. Yes we are talking opinion on both sides, but you are presenting your = opinion as somehow more authoritative with the "weak argument" claim. = To wit... > We use { and } to denote blocks, not begin and end keywords;=20 Begin and end are not declarations in any language. Those are statements = to delineate blocks of code. > 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. Those are closures for anonymous functions. They represent a callable = value, they are not declarations of named symbols nor references to = named symbols. > 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. Pedantry notwithstanding, clearly I was speaking of "public", "private", = and "protected" (as well as "var", but I know that most PHP prefer the = visibility modifiers instead.).=20 All of those are keywords. > 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" Minimally because we need the terseness in type hints for parameter = lists.=20 It would be inconsistent to use colon in parameters lists and then = `returns` in function declarations. > and there are people who would prefer to write "public foo() {}" = rather than "public function foo() {}". Makes sense where it can be unambiguous. Note that there is still a = keyword there, not a sigil. > 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. Sorry, but that feels really ironic. You point me to past decisions when = it support your argument, but when it does not you suggest that we = evaluate "for the specific case." >> 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. >=20 > 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. This one is true. All other C-based languages appear to use @Foo, or = [Foo] for C#. But we can't use those. And since we can't it is not clear why we could = not consider keywords just because all other languages had the @sign or = the [] available. > That means either: >=20 > * 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 >=20 > 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. Most likely because Java chose "@" so most everyone copied it. And the = languages that did not use @ are generally for the more advanced = developers. Whatever the case it does not seem to me that this is the type of case = where we could really go wrong no matter which we pick. Either sigils = or keywords would work, it does not seem like something that needs = exhaustive research. That said, as it seems I am the only one on the list who has commented = that really dislikes this syntax I will let this die if you can just let = it die too because at this point we are both bikeshedding. -Mike P.S. Another approach would be to use at-sign+colon. e.g. "@:Foo"=