Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109869 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 20737 invoked from network); 28 Apr 2020 10:50:56 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 28 Apr 2020 10:50:56 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7DA7F1804F3 for ; Tue, 28 Apr 2020 02:24:03 -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-il1-f172.google.com (mail-il1-f172.google.com [209.85.166.172]) (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, 28 Apr 2020 02:24:03 -0700 (PDT) Received: by mail-il1-f172.google.com with SMTP id r2so19581114ilo.6 for ; Tue, 28 Apr 2020 02:24:03 -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=e0Ag/ArwjpXsQ9NmhczIWqYWnf8fqJUCZfsNyXf5Vcw=; b=NEWJ6a5+5WjyAAf8foj82w4PC+TyKvaXgpXFH1B7gmVUuuv2CBtpraYko+TWuQE6WJ VzYJ2D/yJUR+iseDCmlLz9zPyZPXdREwTD6kUTqjXBQEc4AaYAben9JjuOfylqV96n7g 0NWEk0OJjXjCTJFt79+4RxusAQRjr34E7szgDtaGFimOZTlcSebmx+gch/exDbzC0Von EwBbEIpMKNseCApYQWfet453RHbdu+R0ybrJ2HWmaTtnbW+t2iIac1r6ti6Y8L5aauRd cPskuJ6mg5UbYsUkQkFcVVcim1JFiyRAnTqruQUvKzLfVSejDUQz1AF59gTEpDmR1KI3 Q8yw== 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=e0Ag/ArwjpXsQ9NmhczIWqYWnf8fqJUCZfsNyXf5Vcw=; b=TDO781DGrllRd79svtoKCHHERH5G6ZvVVaznhvpFn97U647O6ZJVRsnuLnPzhdZF3A 75uYQve9iISUjI15+5anicXX4uP8PmwxGumqPV86A6jCgifNEX4AqASscSZYROKOOCC6 PBf1y9K/1cUA6U+squFfOI9/ww3yAhYw+SmpM2LOlYUo1O7bSh2iGmWSyKKP5e/xz6SI B6murA1+GQI2lBAROy+QM1YHy8Nwzh43VJbOM1T1GAXoK9MeYU/wAv3u7iu5kSnprCiP 8KMwgxZlAEhwfJ+EvuwIR9MethaKIeTDqVM8o0SouA+P8HSOarQO5I9iYwlzS1dPqPzr UJmw== X-Gm-Message-State: AGi0PuYnXfWpKqUwryF1/qo1kkcMORFwU4zEJ9uxCaKIXyvyaf0Srk9S egT8YSNHKKdlje474k9v5EQH0fOAVM4FZZGpBxI33JQZ X-Google-Smtp-Source: APiQypIYdIyr5XaHFEw2aaPeRH17BL4urECHDh5lcwugrltzLOsW1KaIwrT3wdReaOpmkfv7V8w+LNAQOGjcdKutklY= X-Received: by 2002:a05:6e02:dcf:: with SMTP id l15mr25708780ilj.225.1588065842421; Tue, 28 Apr 2020 02:24:02 -0700 (PDT) MIME-Version: 1.0 References: <5ea6e4b0.1c69fb81.cf3ee.2bbfSMTPIN_ADDED_MISSING@mx.google.com> In-Reply-To: Date: Tue, 28 Apr 2020 10:23:50 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000006ae38405a4566418" Subject: Re: [PHP-DEV] [VOTE] match expression From: rowan.collins@gmail.com (Rowan Tommins) --0000000000006ae38405a4566418 Content-Type: text/plain; charset="UTF-8" On Tue, 28 Apr 2020 at 09:48, Nikita Popov wrote: > Many people in the voting thread are calling for supporting match > expressions only (without support for either statement form, or support for > block expressions). The RFC motivates the match construct as an improved > replacement for switch, which is type-safe, exhaustive and has no > fallthrough gotchas. If we limit match to returning simple expressions > only, is it still a viable replacement for switch? [...] > Is match intended as a replacement for switch? Or is intended to replace > the ternary operator? Two thoughts on this: 1) Why does it need to *replace* anything? Introducing switch to a language isn't usually considered a replacement for if-elseif-else, even though the usage overlaps heavily. Instead, it's seen as an extra tool in the chest, with its own strengths and weaknesses. I think it's better to focus on what the use cases are, rather than how they'd currently be written. In other words, the fact that it's not a straight replacement for switch may be a feature, not a bug. 2) As a thought experiment, imagine splitting the current proposal into two: a new conditional expression, and a new control-flow statement. To me, the syntax currently proposed works really nicely for the conditional expression; for the control-flow statement, it feels awkward and not in keeping with the rest of the language. If they were separate proposals, the statement would probably end up looking very different. That's why it feels more natural to suggest dropping the statement and keeping the expression than the other way around. Regards, -- Rowan Tommins [IMSoP] --0000000000006ae38405a4566418--