Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109590 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 51770 invoked from network); 12 Apr 2020 01:47:19 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Apr 2020 01:47:19 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4D6F11804F3 for ; Sat, 11 Apr 2020 17:16:18 -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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, 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-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (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:16:17 -0700 (PDT) Received: by mail-yb1-f180.google.com with SMTP id 11so3241370ybj.11 for ; Sat, 11 Apr 2020 17:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=6Kec2aEUOv4ojXw1nYNbgBU4FNPqmfJmzDiXHS2Hw2g=; b=YMT33r5qa50ddGpFWBD3E25CWl4uE44K+RgD0OLNth6fv8BaFFyE4TTDkTHjTlpsRW 5nKOa3A9li5mFgmXu9IMRlBaQ5tRfNJpckdxN6uLzFjMHSGWo/NQtuc6SP4507Slf8VM lKKCOUs4gU7ACjaN4EYZoLcPKWrH4Ax29Fq4OP+ktYeFGxr7QVKhFQZmWPLGY52mfHqb nJfwcpE8qeoh7r4gFUhalY3nvYR24kxbXOTy0Ve0RgRmzW9gIjHbttZUWZ//wahAvAPJ TxYPrQ0PExsFkNSMZp6rvlafLBh9woxptA3WHn93xVOv5SXTMKssekRgPhWaJ2DCcIVb /IvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=6Kec2aEUOv4ojXw1nYNbgBU4FNPqmfJmzDiXHS2Hw2g=; b=n1LVq/5mNTLXrMY4TtLzTbGF2OmICLE1Hi78yxh2wBr/D+NFvBsebqxJCWd9eUZogJ iRKSuW4zAU6ZJJIwRgnWTNXmBU/ETu2upa07vfBbUY6M3NhrLr6Pm7LxpTHQsv5eKYQZ oAolV2JnaHqpDQEl4HJk1/pIas8D26QNRHirCGCfQ7zvD9muj9NyjYLNoFXCjP9bEOz9 THD99XP+JCVv6mo7QEk1lozd4rMoalArd/T57mSlUanqMUfm7i1zJIiz8FkF/6QRkh++ mtIpWDwMFuqXCQ4SJbtcQuKEyJHFRALh9hlVfkZC/LZvM9LXWciFV3+rUCSPJ3ejr6Or 2rIQ== X-Gm-Message-State: AGi0PuZFoDKMdKDGvVPtynXt10/bAPtoXDpfY0FDAOiEZm0fSq2qqZDQ Ww1eB15IXX1UfzSzGn2GeNtj1yqljirP0UVing4pFPHn X-Google-Smtp-Source: APiQypLCeUD6gJJIv0y5OgOeryufTGIE+WIuWDzILRYkjexK5HKT/3LRHKiqVbr1Gee0CqiDv+84b6o+VSuHaMHAgB8= X-Received: by 2002:a25:3bd0:: with SMTP id i199mr16713725yba.297.1586650575102; Sat, 11 Apr 2020 17:16:15 -0700 (PDT) MIME-Version: 1.0 Date: Sun, 12 Apr 2020 02:16:04 +0200 Message-ID: To: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: [DISCUSSION] Match expression From: tovilo.ilija@gmail.com (Ilija Tovilo) 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!