Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110695 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 85073 invoked from network); 22 Jun 2020 16:48:15 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Jun 2020 16:48:15 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4A6B4180538 for ; Mon, 22 Jun 2020 08:35:13 -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.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS3301 81.224.0.0/12 X-Spam-Virus: No X-Envelope-From: Received: from v-smtpout3.han.skanova.net (v-smtpout3.han.skanova.net [81.236.60.156]) (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 ; Mon, 22 Jun 2020 08:35:12 -0700 (PDT) Received: from [192.168.8.9] ([84.55.126.158]) by cmsmtp with ESMTPA id nOTVjFr9bnRnenOTVjpxq7; Mon, 22 Jun 2020 17:35:10 +0200 To: Ilija Tovilo References: <37f1f8fb-0e1b-cc39-f4b6-6c943a731d49@telia.com> <250b7671-2919-9385-c149-931212397e4b@telia.com> Cc: PHP internals Message-ID: <04d86e2d-0815-195a-6111-3034e0ca5918@telia.com> Date: Mon, 22 Jun 2020 17:35:09 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-CMAE-Envelope: MS4wfEAXqM5MioPgLEjr0ppHJNbP3Uqjr6r0fR7jAEzDf8EkBmzyvZTQHYJTeJ2QmuGQo/q3GpCGRpUWEU9a21yjBuSnxx5EdxT6lUElCv+J0RMpcmSEeWN+ +ya3r01o31d/uKcvK8bHxuCq0FZvLnlYuPPYZEAmpawcSv+L18tKt9SG/FbzkUSJcBto5xPLIPYgfuLJxXGe06fL47hSdp0P4DIbCdpn4AZ4ErG1rVq1h2yp Subject: Re: [RFC][DISCUSSION] Match expression v2 From: bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=) Hi Ilija,Den 2020-06-18 kl. 22:51, skrev Ilija Tovilo: > Hi Björn > >>> I'd like to announce the match expression v2 RFC: >>> https://wiki.php.net/rfc/match_expression_v2 >> Well one could argue that when working with legacy code containing >> switch statements where one gradually migrates to match, it might be >> easier to have the same separator, i.e. ":". > I think that's somewhat of a moot point. The syntax of match is quite > different (match instead of switch, no case, no break, colon instead > of case, comma instead of semicolon, trailing semicolon). Just making > one of those the same doesn't make a meaningful difference for ease of > migration. Agree on that! One thing though. Is semicolon mandatory or is it optional like in the first RFC? Feels a bit odd with a semicolon after a curly bracket. >> Is the proposed => separator inspired by Rust or Scala? Checked what >> other languages used and for switch it's ":" of course. So one might >> argue that to align with match statements in other languages "=>" is >> a good choice, but OTOH if ones sees match as an enhanced switch, >> having ":" as a separator is another alternative. > Since nobody else asked for it, just for you I compiled a list of > other languages :) > > https://gist.github.com/iluuu1994/11ac292cf7daca8162798d08db219cd5 > > The conclusion: Most languages also use some form of arrow. It makes > sense to me to stay consistent with those languages. > > Ilija I think this is a very good motivation on why select => as a symbol and I'm glad it's listed in the RFC. r//Björn