Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:110634 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51875 invoked from network); 17 Jun 2020 16:02:25 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jun 2020 16:02:25 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EA750180211 for ; Wed, 17 Jun 2020 07:48:05 -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_H4,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-smtpout2.han.skanova.net (v-smtpout2.han.skanova.net [81.236.60.155]) (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 ; Wed, 17 Jun 2020 07:48:04 -0700 (PDT) Received: from [192.168.8.9] ([84.55.126.158]) by cmsmtp with ESMTPA id lZMAjPVBjgqzTlZMAj7p61; Wed, 17 Jun 2020 16:48:02 +0200 To: Ilija Tovilo References: <37f1f8fb-0e1b-cc39-f4b6-6c943a731d49@telia.com> Cc: PHP internals Message-ID: <250b7671-2919-9385-c149-931212397e4b@telia.com> Date: Wed, 17 Jun 2020 16:48:01 +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: MS4wfHL6zmY8ELG4Ka5+XnrtlKRzXz+ogDGFpe2yqL0OyzigX/J6dNrtjFAsY7aQoytOFpD5IeEK4hY7DVFYx1ca0TFv2aeKY9KFpswjDUsflXgp0Nr03nld zmDcdm1lfl47YdeFq1SUvTT7gLVfxdRQkmgzv9D4o622dZbkT06hpyNDQfkGvmKpTbBFmwtgWsmcWJ/lKEJN6Ywp6IDBytopEKEg5ioJjdO2tfgc2dV+vgz6 Subject: Re: [RFC][DISCUSSION] Match expression v2 From: bjorn.x.larsson@telia.com (=?UTF-8?Q?Bj=c3=b6rn_Larsson?=) Den 2020-06-16 kl. 18:17, skrev Ilija Tovilo: > Hi Björn > >>>> I'd like to announce the match expression v2 RFC: >>>> https://wiki.php.net/rfc/match_expression_v2 >> I do like this RFC and have one comment. Would it be suitable >> to have : as a separator instead of =>? > `=>` is usually used in combination expressions (arrays, yield, arrow > functions). `:` is mostly used for switch cases and the alternative > control structure syntax [1]. `=>` also visually separates the > condition and expression better IMO. This has been suggested once > before but that's not enough for me to change it at this point. 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. ":". 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. Anyway, I think it would be good if the RFC is updated with what other languages uses, since that is a good motivation for why using "=>" as a separator. What bothered me a little with that selection is the usage of the "=>" symbol for other things in PHP. Hint, I was a fan of the "==>" for arrow functions ;-) r//Björn L