Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109597 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 69073 invoked from network); 12 Apr 2020 16:35:45 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Apr 2020 16:35:45 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1A34F1804E4 for ; Sun, 12 Apr 2020 08:04:55 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE 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-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (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 ; Sun, 12 Apr 2020 08:04:54 -0700 (PDT) Received: by mail-qt1-f176.google.com with SMTP id b10so5328977qtt.9 for ; Sun, 12 Apr 2020 08:04:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=newclarity-net.20150623.gappssmtp.com; s=20150623; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=ZZTLqvsm4I8WTv4uvORAqjS5H4e/sKClaASSG+3zzWA=; b=MLZxGG7Es/ZUZ+fopj/YaoKUcC4MBrQ67g975+XFOH+lI2u4QrJrx2VyqRyFVLRkZK g/t8OJX+CsWh8kY3D/6sAcTvflwPomEu4/eYwPNpJYn7qSfwNW6bw/KwysmtlEqBsG7O eUwmK/aPEVI5XGdjDC4gRMlPhHXS0rmHK5uB5MUfVz6d7luyUTT7mEy0i+yBeAw8j7dv fUhhyUwUPNE3uQaehFew1e2huUENwUuZlcAB0OO5G5dBzpXUvvMDxcmiZzOusBzzAZJw GzhjG/DhLe6Bfkz3LJDvxF2rw0Kl2zH5DWBmDc2mS08Li78dEi6iluOGdnC/KXXC7kwO hxbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=ZZTLqvsm4I8WTv4uvORAqjS5H4e/sKClaASSG+3zzWA=; b=bL4rL6/MwYglyX2bN9b/Bb9ZLhl5R8NnhAtdl/Rieom2W4y6SRbPr5J86Q+b0jU5qN W2CQ8V9Rq8waoRBC5o6ieT7TMlGHNNXVP/0zLHwztT2DRmpEkrwYmqmG6YJ7BiSSqkvs Y1XsjV7yicesfHz5rSVSBsLEyrAel/Kguk5pWnpzHqJjvgZzb0h7VZu0l0grF48vdAdk kkAOp3iyEAtgcZ1Czq2fUxuLswmjkwBvVIH5SEsxYAsWBJbn7UO6Pc48lQmxKZAbaqbY 0gdBYo2rUYi28L/vEDOkYHRpzzO5LKEs7DAH66gpgGF7pUIXt2KzozQ5zONPFYHJLoGc dcSQ== X-Gm-Message-State: AGi0PuZ3Fxw2P5h5oMCV4en/jEXeSEo5O/2MUdiW2Qo7KpNXkneUIxY0 QbXunHqAayh8xUur1sZCv56CFA== X-Google-Smtp-Source: APiQypL7+VRi3am4yhwv+ODr+4OsPc/ibv5dwYmx+n5c8mfI9jN43UGLuo20HwOkwmFoTOBpe2FRtA== X-Received: by 2002:ac8:6902:: with SMTP id e2mr7229976qtr.214.1586703892895; Sun, 12 Apr 2020 08:04:52 -0700 (PDT) Received: from ?IPv6:2601:c0:c680:5cc0:c0dc:107:3ef1:77f3? ([2601:c0:c680:5cc0:c0dc:107:3ef1:77f3]) by smtp.gmail.com with ESMTPSA id y24sm5807180qtn.87.2020.04.12.08.04.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Apr 2020 08:04:51 -0700 (PDT) Message-ID: <5E37A931-9ED0-4CD9-9044-868A322BB6E5@newclarity.net> Content-Type: multipart/alternative; boundary="Apple-Mail=_57C9E0CC-3AAB-4AB0-B42B-711C6BF0535F" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Date: Sun, 12 Apr 2020 11:04:50 -0400 In-Reply-To: Cc: PHP internals To: Ilija Tovilo References: X-Mailer: Apple Mail (2.3445.104.11) Subject: Re: [PHP-DEV] [DISCUSSION] Match expression From: mike@newclarity.net (Mike Schinkel) --Apple-Mail=_57C9E0CC-3AAB-4AB0-B42B-711C6BF0535F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I love everything about this, except for one deal killer. I love the use of =3D>. And I love the blocks.=20 =20 Plus I love that it can fully replace switch because of how using switch = can easily allow an developer's oversight to introduce subtle bugs. The deal killer IMO is this: "match was added as a keyword (reserved_non_modifiers). This means it = can't be used in the following contexts anymore: =E2=80=A2 namespaces =E2=80=A2 class names =E2=80=A2 function names =E2=80=A2 global constants" -Mike > On Apr 11, 2020, at 8:16 PM, Ilija Tovilo = wrote: >=20 > Hi internals >=20 > 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 >=20 > Due to the feedback I decided to take the RFC in a slightly different > direction. The main objections were: >=20 > 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 >=20 > 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. >=20 > 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. >=20 > I also experimented with pattern matching but decided against it. The > exact reason is described in the RFC. >=20 > I'm now confident this is the right approach. I hope you will be > happier with this proposal. >=20 > Happy Easter! >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 --Apple-Mail=_57C9E0CC-3AAB-4AB0-B42B-711C6BF0535F--