Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109899 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 62681 invoked from network); 29 Apr 2020 02:04:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 29 Apr 2020 02:04:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D781B1804C2 for ; Tue, 28 Apr 2020 17:37:49 -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,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-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (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 17:37:49 -0700 (PDT) Received: by mail-io1-f52.google.com with SMTP id u11so374895iow.4 for ; Tue, 28 Apr 2020 17:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=5OhIqcJ84pAGqwXQ2zZe9Ex9viFXn/wjBAg9nbwljn8=; b=Tokcc5/5Tsa8CWA0FvfQ31gEU1nccGEXNKxFPTfdm/yizQ2alr3he7KH342r11sI0V 48XSeuoFucaaB7NCBjLgtwftFBggMRJ0G84unwC45/dD+drkCkQlgtPR6VuJG0N0qYME +KIkqPBPghtZB+I/9lTLWsOL9LdRMfotrj6Hg= 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:content-transfer-encoding; bh=5OhIqcJ84pAGqwXQ2zZe9Ex9viFXn/wjBAg9nbwljn8=; b=dyLwTENUWQTsiRr4WoyP7k/yfw3PTZI5ZVF/+GlS9i89K3URygCfGNFg9BQPrJB4Jy pKuDb6yPSJp4vcMJ1+AADcje981mzv09NoWEx1lEx5XYA81XJg6qVXMpFvBHZjrccocp 1zxwe/aKDhFNwBtT/F1XKL0TS/mPBSwMv6kjp8AR6xqanDKO5/N7LOorXW9qrd/98JJP r3ihJWP6OYR0XH4te/sFFAMWU6mR8AWqW/C/rUDNO8nP6/UUz8dTOf5A62Xq/Ar2t01K BJQqJB7iFzho1LU9fjGIMEBCX0Or8rHhfCgToF69ygLIhtVQmUBAwCQEZL67gGDOtvXn 3meg== X-Gm-Message-State: AGi0Pub7w6JT/v6vdISSq7UPLhMleRMdgYdg+h/bJM6/b+XbUfTifp/9 OyHfYEtPHz1a00vFujB/E5Ycq2Eui+apZ3RQVfwWCw== X-Google-Smtp-Source: APiQypKtlozK/BzB6y4uCVpZ09z7BS8KzFwtprnv7Bse0yzsaCM/Euz0fKCaiHa08wA9o0IJBEeSJk0l4XFQU7QBQH0= X-Received: by 2002:a5d:8155:: with SMTP id f21mr29380410ioo.151.1588120666871; Tue, 28 Apr 2020 17:37:46 -0700 (PDT) MIME-Version: 1.0 References: <5ea6e4b0.1c69fb81.cf3ee.2bbfSMTPIN_ADDED_MISSING@mx.google.com> <969c6150-a084-48c0-ae8f-b8043dce321d@www.fastmail.com> In-Reply-To: <969c6150-a084-48c0-ae8f-b8043dce321d@www.fastmail.com> Reply-To: Levi Morrison Date: Tue, 28 Apr 2020 18:37:36 -0600 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE] match expression From: internals@lists.php.net ("Levi Morrison via internals") > One issue that was discussed a few weeks ago, and led to the current synt= ax, was too many variations within the switch syntax; of course, trying to = do it all in one syntax is perpetuating that problem. However, I think Row= an has suggested a syntax that may be sufficiently self-documenting. To wi= t, independent of rustmatch (above): > > switch ($foo) { > case 1: { > Many statements here. > } > case 2: { > Many statements here. > } > } > > The curly braces are already understood by most PHPers to mean "a block o= f statements", and so it's a logical jump in this case. As Rowan suggests,= the {} imply a break. To keep it simple we should probably not allow mixi= ng and matching in a single switch. Either list-style (break required) or = {}-style (break implied). > > That handles break; Sadly, it doesn't. That code is valid today: Which outputs: 1 2