Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102461 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19156 invoked from network); 26 Jun 2018 18:27:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Jun 2018 18:27:44 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.48 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.48 mail-it0-f48.google.com Received: from [209.85.214.48] ([209.85.214.48:38562] helo=mail-it0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/52-01794-F95823B5 for ; Tue, 26 Jun 2018 14:27:43 -0400 Received: by mail-it0-f48.google.com with SMTP id v83-v6so3700822itc.3 for ; Tue, 26 Jun 2018 11:27: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 :cc; bh=g7XoCLzP5+Vxo6wGcxHs2eBLrDZk29com9XMoQUxrTQ=; b=FlNZsBvTRkVnFGhq8AxTUdIvOO4fVbvOGZBDbAKxwENTl9+mMbfXKNJV5JnZdbcHCT p4P8jn4UxRbnzLCbt958tFQrRiJbXOfIjOwV8KsaoIbVtFaqiOz4zn9kAdtV7f4IBxKC KckLj9Axo+ipIwkDYrFDnI2U3VZJ8jph/FKjs32Rv85SRYkslI0OirASqMPBFGcrTNY8 btB1ssTgVvv1IAUOwa2iNd4qIosatIADXXb1HoLXANlvxzNoiEYYrSaAnSuTT7ApUCyn eL3Fcw788dDDCRaovtOB7+An3vYQGEg6upD8X4fLd4G2RkPlJRSeynruyOFsMPIogPkU kgaw== 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:cc; bh=g7XoCLzP5+Vxo6wGcxHs2eBLrDZk29com9XMoQUxrTQ=; b=SQmjH51BEv2gmTOx2puSsnUG0MEwM6R4byXPqqCXasIj2w1HNQYjcFrbVMULqhP/ME z9Fm0r/dzmej1YOP6igTTy+Lt1XkWuizph5KIniGd4qMYi2O20K2RzRAnG+i6WMUIsDF 2L234Rz7BniyXnn59AB9XS3Mv7fKz2h/+yJLOuoqYcmfbRgt1teSy4UoMqOGVYqFjOis hdzTpqAWyZ3Yu7s9yDyCyTswC20JWmn48gKOORS41qzhZPtYypryIvKxlHQc2M8B26ag UwMYnO3Q028hLiTNS0wtUUC+NuxBHzGaDx3zPX0wQxlC+v5jGjO3VQdR6UHQAUVUMr56 pmlw== X-Gm-Message-State: APt69E2DcgknJvqMHgroRqvxFTVvojh/FQ5xamOeUy/3RiTolvH46dDK 9iGjmt6aenzQVKZjy6iTHcRevkdDlLYAy8+AGH0= X-Google-Smtp-Source: AAOMgpc51/NtJWJKnJywFPExcPkP9cNVfECAzA+q7Tjkwt5boXYAlP9EAPSLrX19j2zZIECqYyv6qrZ91sc8YX8rAb4= X-Received: by 2002:a24:d309:: with SMTP id n9-v6mr2540615itg.6.1530037660602; Tue, 26 Jun 2018 11:27:40 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:fe16:0:0:0:0:0 with HTTP; Tue, 26 Jun 2018 11:27:40 -0700 (PDT) In-Reply-To: References: Date: Tue, 26 Jun 2018 20:27:40 +0200 Message-ID: To: Stanislav Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000040d6fe056f8fa731" Subject: Re: [PHP-DEV] [RFC] Deprecate and remove continue targeting switch From: nikita.ppv@gmail.com (Nikita Popov) --00000000000040d6fe056f8fa731 Content-Type: text/plain; charset="UTF-8" On Mon, Jun 25, 2018 at 7:53 AM, Stanislav Malyshev wrote: > Hi! > > On 6/24/18 9:16 AM, Nikita Popov wrote: > > Hi internals, > > > > Another small deprecation for your consideration... > > > > https://wiki.php.net/rfc/continue_on_switch_deprecation > > Not sure I understand - what this is improving? Yes, continue being the > same as break is slightly surprising, but it doesn't seem to hurt > anything and I don't think it happens too often, so why change it at all? > This RFC resolves the following issue: 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. b) On the other hand, other languages, such as C and C-based languages, use a different behavior, where "continue" refers to the enclosing loop. As these languages don't have multi-level breaks, these semantics are also reasonable. This leaves us in a position where "continue" means different things in PHP and in other syntactically similar languages, causing confusing for programmers familiar with them. This is solved by simply prohibiting the case that is ambiguous. This is not a loss for PHP developers (who use "break" instead of "continue" for switch statements anyway), but it is a gain for programmers from other languages not familiar with this detail (as they get an error pointing them to one of the correct alternatives). All of this is not a big issue, it's just removing a papercut. IIRC this was originally motivated by me seeing some bug reports about this behavior. Nikita --00000000000040d6fe056f8fa731--