Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102500 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19604 invoked from network); 27 Jun 2018 17:43:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2018 17:43:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.208.44 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.208.44 mail-ed1-f44.google.com Received: from [209.85.208.44] ([209.85.208.44:39953] helo=mail-ed1-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/C1-01794-FCCC33B5 for ; Wed, 27 Jun 2018 13:43:44 -0400 Received: by mail-ed1-f44.google.com with SMTP id m15-v6so3578255edr.7 for ; Wed, 27 Jun 2018 10:43:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=3y8GHOOmi2QzJ7MoZrtE85IBQpG0OE/Z84et2mU2lO4=; b=N87inbWbncgwAv5NNLzj+81evadCgveDO+2GWM0AGb7GKQ6pO2HagyRTLWAvh/T/iW 4Me2VsZYBVKx3sFuD+f9czhEYzwf7T7FH7oztcMI5rJPtRMzwml99R1lRjMIav1troRv z8OhEA8ZBJongqplH9r3DaBGpx0VTSOE1zxXEZiblULGXUMZhVgZh5pU1ZW9cr0F2Qkl XJH/Vh6M1TRbHwVUuiIsqJTA08srSDOtmwJD/Qt1KWDS72BACg2qluDhkCneWlrhWRIr 1NHW3DBgTDEZUaFY0MQfjB9x15hDS7alh9Uc5z/bTCdzEgZmqNg73/R9X0XdVN5RMuaF hw3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=3y8GHOOmi2QzJ7MoZrtE85IBQpG0OE/Z84et2mU2lO4=; b=E+B85w7yaZG3zybg7UAeYCk1XHc25z+BNu4+jnu8lRBJYFnt3Of8icc59nVjknm+aF ZHkabVYJgtW6SJLg7yRMoB6bU5UkZ1alFCUSzriBn/Nxbb+g/n5fJS4QabjOYopU6pP1 doCGtko2D5wWoTRvV4A7z90CWDsyFh9Fur8F53EHzleamqmD027s1peQdHv6p61jWmZv UFqR8YaZOcFwgAeDZ4zXmuMESWUyuVW39CXv3lFpzLX9bgO28dG8E5ofdf3tzh2IXfhJ bkIv7rXWWezFZ5m7+JGZgOpiMG+WX5jnpmduCMtTryngZOy7wPE9mLXIo0Ov8MJh5gAy HkTg== X-Gm-Message-State: APt69E1Ohob5okV8NJBEYiVgHsmtqFpN13vTWwEleS8RCJVypiNbQN+A TQ3FBFEQDbTtu8eiBDkAxDJ3/YW4JCtn/eiM9RA= X-Google-Smtp-Source: AAOMgpekhYBC4cFttqtF8JyW6ipdoQItkG/1b6c/WJoyPwxiTyzlBSmAb9vEsych6ctvUHCuJhPB1q3Xlq27dvjGp28= X-Received: by 2002:a50:ba3b:: with SMTP id g56-v6mr6479407edc.85.1530121420368; Wed, 27 Jun 2018 10:43:40 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:8863:0:0:0:0:0 with HTTP; Wed, 27 Jun 2018 10:43:39 -0700 (PDT) In-Reply-To: References: Date: Wed, 27 Jun 2018 18:43:39 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000b96f09056fa327bd" Subject: Re: [PHP-DEV] [RFC] Deprecate and remove continue targeting switch From: rowan.collins@gmail.com (Rowan Collins) --000000000000b96f09056fa327bd Content-Type: text/plain; charset="UTF-8" On 26 June 2018 at 19:27, Nikita Popov wrote: > a) In PHP "switch" is considered a looping structure, for this reason > "break" and "continue" both apply to "switch", as aliases. For PHP, these > are reasonable semantics, as PHP supports multi-level breaks. It would be > very questionable if "break N" and "continue N" could refer to different > loop structures just because there is a "switch" involved somewhere. > I think this point should be highlighted: this is not just an unfortunate legacy decision, it would be *really bad* if "break 2;" sometimes referred to a different loop from "continue 2;" Other languages don't have that problem, because they don't have the "continue N" syntax. I'm +0.5 on Nikita's proposal to make this an error - it can't mean anything other than "continue with this switch statement", but that doesn't actually mean anything. The error is effectively saying "Can't 'continue' a switch, because it's not really a loop." Perhaps rather than deprecating and removing it, we should simply raise a Warning on its use: "Use of 'continue' to terminate switch; did you mean 'break', or to continue a loop instead?" In other words, "we've done what you asked, but we think it might not be what you meant". Regards, -- Rowan Collins [IMSoP] --000000000000b96f09056fa327bd--