Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109591 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59046 invoked from network); 12 Apr 2020 02:29:47 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Apr 2020 02:29:47 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5CD381804C2 for ; Sat, 11 Apr 2020 17:58:50 -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,RCVD_IN_MSPIKE_H2,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-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.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 ; Sat, 11 Apr 2020 17:58:49 -0700 (PDT) Received: by mail-ed1-f47.google.com with SMTP id e5so7298428edq.5 for ; Sat, 11 Apr 2020 17:58:49 -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 :cc; bh=ebjLAQrjutrSbkLO8jmC360eAWMH0VFc9YKfylkCYqI=; b=Tq6MLPsSkKp19VopPuNVaH9FFL1+2WvC5yQ+ZyDVI4DouZ5W+sPZ9ai3UN5Dhda7y3 uzPp8VgXs2vENgzbT1k+HZvsXytsfR60a62Kbk/P2kdbG6QWCBQK4aCjhX5UMqYj3+2C yT0D46h/JQ9ZYl6IuJlyTtrIfc09dGctSbwRorQoBYN0C5ye/2wZ0RCG8ucYLiA/W06p 63tGqXqicjJUW9FnMjrNqAnXyNtS9q1Ub+mxVc67geOOSJ+dlOqZwr0lwt2KOsSo1T5V eb9dT4npmz13MLLqRPlcBS/MIotgjF2Xbihb3+RBAtMJKM25iIw/eJGs8cev8eIZzOKJ OGpA== 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:cc; bh=ebjLAQrjutrSbkLO8jmC360eAWMH0VFc9YKfylkCYqI=; b=auRCTlB941sgRRKvIOfDSv7CH7E1FY2/DAOueXFEfoil6UzEEjCuKsK7zKhZi+6wec BiMycClme7eQaQA5SA9aGBDDxII/vfYWbh+k+e0LvFGKUl+7eB9H+c3rEkfcCc1XW0OP mm2Fsbt32VRZfdKAe+aKyGHSwukXxcDDMBrAowLJngbk88emzFNM57m1NgKZQAwEahwZ ISLTXDBxFalQTCgKy5+9PBRiqRsRIiKrBAh6KxO1lbXo6eJY49fYA479Z5iJS5sA1msB OQIfOz0mMs8XI7WzFYC5+zL4l0pBUURtz1Lzpt2lEbN9F0oPGx14B0rH4lNKseAsiXqm p/5A== X-Gm-Message-State: AGi0PuZNML5Qg7GoW+UocRTm2jIYggDr1HRlD3uoqE8dEnnIMZhQZUEj SgCsQVJSGbrRfbICsjSnzZTtwGYh1t+m8vn+39c= X-Google-Smtp-Source: APiQypI9TgHm57U9WKXPf2ubWVzHnvt2WDhGD4d3Fpyz28S7tT0G1MZ56ys0M48saaGwxIN/poa4a1VEs4F09eYQii8= X-Received: by 2002:a05:6402:110a:: with SMTP id u10mr11053390edv.159.1586653128240; Sat, 11 Apr 2020 17:58:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Sun, 12 Apr 2020 02:58:37 +0200 Message-ID: To: Ilija Tovilo Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000017310605a30d784f" Subject: Re: [PHP-DEV] [DISCUSSION] Match expression From: george.banyard@gmail.com ("G. P. B.") --00000000000017310605a30d784f Content-Type: text/plain; charset="UTF-8" On Sun, 12 Apr 2020 at 02:16, Ilija Tovilo wrote: > Hi internals > > I'd like to announce the match expression RFC that replaces the switch > expression RFC I announced a few weeks ago. > New: https://wiki.php.net/rfc/match_expression > Old: https://wiki.php.net/rfc/switch_expression > > Due to the feedback I decided to take the RFC in a slightly different > direction. The main objections were: > > 1. It didn't behave like the traditional switch so it shouldn't use > the switch keyword > 2. It didn't fix type coercion > 3. The RFC was poorly structured > > In hindsight I understand why I had a hard time writing the RFC. I > tried making a case against the switch statement while really not > addressing the switch statement at all. The new RFC proposes a match > expression that fixes all the objections raised against the switch > statement. Additionally, match arms can now contain statement lists > which allows you to use the match expression anywhere the switch > statement would have been used previously. > > While some people have suggested statement lists aren't necessary I > don't think it makes sense to raise objections against the switch > statement without offering an alternative. > > I also experimented with pattern matching but decided against it. The > exact reason is described in the RFC. > > I'm now confident this is the right approach. I hope you will be > happier with this proposal. > > Happy Easter! > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > Hello Ilija, I think this is a step in the right direction compared to your previous attempt. Your reasoning for not including pattern matching in this RFC also makes sense. Moreover, this could be added at a future time when it may make more sense. One small decision that I personally disagree with is the usage of `=>` compared to using the colon as the switch statement does. As for me => means assigning a value to a key which isn't the case here IMHO. Also, combining this with less/greater or equal than binary operators makes for a rather confusing line in my eyes. E.g. Zend/tests/match/004.phpt in your PR, I don't really see the separation from where condition and where 'case' starts: Best regards George P. Banyard --00000000000017310605a30d784f--