Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109496 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 28903 invoked from network); 1 Apr 2020 12:53:11 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 1 Apr 2020 12:53:11 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 297A91804C2 for ; Wed, 1 Apr 2020 04:19:34 -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, 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-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) (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 ; Wed, 1 Apr 2020 04:19:33 -0700 (PDT) Received: by mail-yb1-f169.google.com with SMTP id l84so13023858ybb.1 for ; Wed, 01 Apr 2020 04:19:33 -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=Il63jn9UBNc+nxtvdbXdtjlU2zFAfPXgtORz6iRuEnE=; b=lA75T4Tz8ySH7ak9q5itVKRbK7GS6omVU70lFq1YAuCd5cko2DZgYyWxPfKZX2gLYD 9jlYFUZKmGwDHaYR3uIeLWQJo+mtegynAWxsThbuNo35thwFDACTcH3mIqbLt+z/ZCmL a/cAIgcisA8kI0OezxDuXdGinbs1wNjpN00sT+RVrN+Z2NK/gIOr1Zsm5lbdkMfDhxsY KS68GUhG/yLEmNuqCiVY1J5GEuzdVCtY/oL+ECvN4NsWRj/Y8tiMou+gnpxg46LF5vxd J6cQk7fTBWZ/dNdsVqnO8/0TYXvhy5ZhBFfNG9E/uzDZ5OXUBVB2wUOeKkinoqh7gi5s /2kQ== 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=Il63jn9UBNc+nxtvdbXdtjlU2zFAfPXgtORz6iRuEnE=; b=ez0iDNF8s8DQPfHo4A9/IB//Pb9DT4Ekl+rvKP9wx0eO25T5pK0bHuXrLlMTXW9wDR kMA1wmLjt/rI63Ao4KAwFaNrLB9CxGkud6pwcTy5oZVFszZEpwe76Sv8v4frRKV4ivMi J5vfW3OTjT9rBw5zBcrY+ak68d3d7eo9zgMUxhpGiye9qMijvFxZFFgmAWbsdZR3+QoL YwzsvcuVP5hqiL/sfFYVpPujP8l8d/+bdCU2uK+r+jNudmGL/w3kjFgA2vV1YK+OiPev 21NFCv3eEg0EVl8Uc9Yua7lv41/GZjCanghV5pHbWAh5tzQM6Bd4WNEh5yneBqEBTDF+ 8dDw== X-Gm-Message-State: ANhLgQ2v6FE53HEY0UTNK7n4oTs54jA3Wmq6mlZJhQBAKSU5gSD8e5ik CHOKjYBFuWw9vLReDETTZueF8q1E5w1z84uySFI= X-Google-Smtp-Source: ADFU+vsQMCiDWgzQN3hvtzzuJDdxNZxKoECEk9J2WlfV0ouXnFH1bIFLXXwCiwJg2f0X17Y5oBXeuiBirTRRAZqYn/M= X-Received: by 2002:a25:d411:: with SMTP id m17mr13863986ybf.2.1585739973052; Wed, 01 Apr 2020 04:19:33 -0700 (PDT) MIME-Version: 1.0 References: <7E3BE38A-1DAB-4523-871A-7AAEE0E697C4@gmail.com> <76ebf15d-5f4f-f5a9-365c-d2e829c9961f@gmail.com> In-Reply-To: <76ebf15d-5f4f-f5a9-365c-d2e829c9961f@gmail.com> Date: Wed, 1 Apr 2020 13:19:21 +0200 Message-ID: To: Rowan Tommins Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC][POLL] Switch expression From: tovilo.ilija@gmail.com (Ilija Tovilo) Hi Rowan I agree that the structure of the RFC is sub optimal. Honestly, I've rewritten and moved things at least 5 times and it's still not good. I'll see how I can improve it. > so we could maybe combine them with the break keyword: > > $y = switch ($x) { > case 0: > break 'Foo'; > case 1: > break 'Bar'; > case 2: > break 'Baz'; > } We can't really do that since break already accepts an integer telling it how many enclosing structures it should jump out of. > The other issues discussed in your RFC - fallthrough, inexhaustiveness, > type coercion - are valuable things to discuss, but each one takes this > further away from being a "switch expression", and into being "a new > value-matching expression". As I said in my last e-mail, I don't think > that's a bad thing; I really like the proposed syntax, as a new > construct for picking one of a set of expressions, and would be happy to > see the RFC re-focussed in that direction. Yes, I can absolutely see your point. The point of the poll is to see what direction we should take. After that I'll try to clean up the RFC. Thanks! Ilija