Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102490 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2330 invoked from network); 27 Jun 2018 15:33:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2018 15:33:23 -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.67 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.208.67 mail-ed1-f67.google.com Received: from [209.85.208.67] ([209.85.208.67:47008] helo=mail-ed1-f67.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/6E-01794-24EA33B5 for ; Wed, 27 Jun 2018 11:33:23 -0400 Received: by mail-ed1-f67.google.com with SMTP id r17-v6so3348450edo.13 for ; Wed, 27 Jun 2018 08:33:22 -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=ROZemiEm+8VKsXtdfhGnyxgJQwmSnV44PnxYDq+IJko=; b=m2/OFFgEyJQAdcqwnaeSeKntvtbomK5c2rl/T2cBt0v5ow1300B82C1IGenex5yNBk 2t6Y0sssxiNk/X053Qq9DmIZ1mX77PPDm9ZUjPct/CWBwR/dUnLMtwNlNmWPvhB17Dh3 LnqhKDYc5MLO+y1rbYCcqnrAU/aL5iOZtHEQIlVGLhJ1RWp8WgcHhu3uIfecqHFNDyxy tYh4L4+e76N4okfAXUJ5KWFERJU/pTqx/BtcKmmxmRDjtho0pq3kLwl8EQGeosRKklxB 7OwTkmplpZUFAGwc81dBagB09DeLAn7jJ3IYUEGa6EtXawkyTxMhMH78foehxK9JP7E7 +mNg== 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=ROZemiEm+8VKsXtdfhGnyxgJQwmSnV44PnxYDq+IJko=; b=diQ4IgCqp/x+LrSSWGPSM5zIdEXl3B/xriJC/2+AAH0H0fGWx8I4rE1sdm+ZS+2yUg 4zeuh4RFA8m9vCU/usFK5CDcb969HQDrfqpMSdq9Uz+PMbrxKj1lmyZ3JQZ4g5p+vJb5 SaFqtqrRAZEy2kihSptlnGwbXYRFupEfBIcGekhp9D2jkxWhBm+O6Y9hkNj2rHHj++FW 5T9B/LjhT1DSmDzeG185lJMLXj3bxbeJHZQkkLRUhQd9zx/VavsmWUiTBD0+fkubiuxF 1ceeXTzC37lOdbEiqK3FHONjQWgtWrAd9njx3gW9GLYLiVHS0NIXv3xCwFuXTBO6YGt0 mbeg== X-Gm-Message-State: APt69E1M3oDeZewIMoOuzV9u7mjgQzR2heyIeQBjIhRLUjXilALZ2Dj5 7j6e4VePQ1PxnpiMTF6saCTI0ivxcNgDQtjcMbCsWQ== X-Google-Smtp-Source: AAOMgpd9jNHtUcdH9uzQN3dcbCWr8DhjuzdO9vXUMSD8GjMmyNdE+rp76hVvGHwVhMD7w1SH3ox/CKW1vFUC715chss= X-Received: by 2002:a50:8143:: with SMTP id 61-v6mr6287760edc.100.1530113599734; Wed, 27 Jun 2018 08:33:19 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:8863:0:0:0:0:0 with HTTP; Wed, 27 Jun 2018 08:33:19 -0700 (PDT) In-Reply-To: References: <17c367f8-3aeb-277f-36c3-f019e6d0d27a@blueyonder.co.uk> <94ff9afc-b3b0-0ae2-55bd-ce6c3936967d@gmail.com> Date: Wed, 27 Jun 2018 16:33:19 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="000000000000940846056fa15509" Subject: Re: [PHP-DEV] [RFC] Deprecate and remove continue targeting switch From: rowan.collins@gmail.com (Rowan Collins) --000000000000940846056fa15509 Content-Type: text/plain; charset="UTF-8" On 27 June 2018 at 16:14, niel wrote: > On 26/06/18 21:49, Rowan Collins wrote: > >> On 26/06/2018 20:28, niel wrote: >> >>> On 24/06/18 17:16, Nikita Popov wrote: >>> >>>> Hi internals, >>>> >>>> Another small deprecation for your consideration... >>>> >>>> https://wiki.php.net/rfc/continue_on_switch_deprecation >>>> >>>> Regards, >>>> Nikita >>>> >>>> IMO the proposed illustrations will lead to as much, if not more, WTF >>> from other language users as current behaviour. Why? Because the programmer >>> still has to account for the 'switch' in how continue works. This will just >>> cause a BC problem for older code without adding anything for people new to >>> PHP. >>> >>> My suggestion, is to make the break (no pun intended) be clean. >>> Deprecate use of continue from usage to escape switch completely in next >>> PHP, then remove that functionality in PHP 8. >>> >>> >> Do you mean that this code would be valid in both PHP 7 and PHP 8, but >> mean different things? >> > > How is that different to the illustrations provided? That code is valid in > PHP 7.0-7.3 but will have different meaning in 7.3. > In the proposal, the code is valid in all versions of PHP up to and including 7.3, *and represents the same algorithm in all versions*. The only difference would be the side-effect of issuing an additional deprecation notice; that's not "a different meaning". In PHP 8, under Nikita's proposal, the code would not be valid at all. The RFC reiterates this under "Unaffected PHP Functionality": > The meaning of continue and break inside switch never changes, some cases are just forbidden. In contrast, if we make the continue that previously referenced the switch now reference the loop, the same code will work in PHP 8, but now *represent an entirely different algorithm*. > > Ultimately, I was trying to express what Zeev said better: > > Ultimately - even after this change, C developers won't be able to use the >> C semantics they're used to, as (e.g. in the example in the RFC) - >> 'continue;' won't work as they'd expect - and they'd have to acquaint >> themselves with 'continue 2;'. It's true that if we 'force' them to >> acquaint themselves with multi-level loop control structures there's >> reduced 'continue;' erroneously. But unless this is really A Thing, as in, >> something pretty common - I think the mess involved with forcing people who >> have working code to try and (a) understand the change, and (b) understand >> their (potentially quite ancient) code flows may outweigh the benefits. >> > > If we change the behaviour, rather than removing it, we solve the first problem (C developers will get the semantics they're used to) but we will make the second problem worse (people with working code will need to understand why it now does something different). Regards, -- Rowan Collins [IMSoP] --000000000000940846056fa15509--