Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102478 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64740 invoked from network); 27 Jun 2018 06:00:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2018 06:00:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=vsuraski@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=vsuraski@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.52 as permitted sender) X-PHP-List-Original-Sender: vsuraski@gmail.com X-Host-Fingerprint: 74.125.82.52 mail-wm0-f52.google.com Received: from [74.125.82.52] ([74.125.82.52:35802] helo=mail-wm0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/39-01794-E08233B5 for ; Wed, 27 Jun 2018 02:00:49 -0400 Received: by mail-wm0-f52.google.com with SMTP id z137-v6so4063573wmc.0 for ; Tue, 26 Jun 2018 23:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:content-language :thread-index; bh=URVeMQlTzRDRXifzBmiGeL+0umo98rR0dE+qvuyb28A=; b=VdYIR1yB+yD+p/JfNv1kZXC3l2ciYK5zVHHX2DryeeteDUnkn67fT4O7ykVww8zDB4 otMgQjinYVpvcLbvP4o1lMY7hv0f16AEcaM9vszOnzg+adVV2hhgov/ZteG1syDQx2ig LoG+Q0UynBSmdKitwUv5FKjY5wIOhDHkeC/KwDRp+BGsaEAvMh44uq3cZpbnbomeJzoy aioocbhtoIh0KRdfyfWOiFoph583Z6uoUVxw+POvf8Fex6XTJIbSi+s6fwwdIDpaxEpX 0rgxpHUDLMzVGAa9gdA23+oaOG3MdvdJTRKsGlNUCuWsQX1wOoarideN2exTmBNhWcH0 sC2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:references:in-reply-to:subject:date :message-id:mime-version:content-transfer-encoding:content-language :thread-index; bh=URVeMQlTzRDRXifzBmiGeL+0umo98rR0dE+qvuyb28A=; b=lXU7V57QDKExicJt4pC9W/2VBpcOERtTDDontQjCBRzb7ONfwmtjxy31843ztq8oTk iaPyCXwdIZP9tlkXk5pecdnyfRkjQStWfwxPj12zw0jQeMhie7SVK4dGylIMLw/MlkV0 +xEg8jToWLshfyCLvcIVPRAtDyib8eYPjgOLvluCvkONQADGIm99tWTPrT6B0vDQegcR CyGLuK28CQYEyCM637AYOq7LZa7TrRlLDfhfJsAP2WYjorpBPIpM1Cfhk2wHZt/WZYiu 6yWhfBEodernjYYiAIESp0YLQxUUFhqlGdk7Zw/peDHhTftCX9At1ID2GG3HUAiBl7L7 SXwQ== X-Gm-Message-State: APt69E33LbKKry2DdOlCCu/CMdK0As6GXpZUVWn+oq1YnUe6UvMy6H0p x+4MGQop6ZXmxakTblnxQeQPF2ws2A4= X-Google-Smtp-Source: AAOMgpec78kU2/d0FRywLOW0IaqfZoKFhhfq63cnXG4l7Uo5NbTwa/+lVSLFniDipb80Cp01IHjBqA== X-Received: by 2002:a1c:99c5:: with SMTP id b188-v6mr3464738wme.15.1530079243466; Tue, 26 Jun 2018 23:00:43 -0700 (PDT) Received: from eCenter710 (bzq-79-180-247-42.red.bezeqint.net. [79.180.247.42]) by smtp.gmail.com with ESMTPSA id w126-v6sm4206835wmw.29.2018.06.26.23.00.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 23:00:42 -0700 (PDT) To: "'Nikita Popov'" , "'Stanislav Malyshev'" Cc: "'PHP internals'" References: In-Reply-To: Date: Wed, 27 Jun 2018 09:00:36 +0300 Message-ID: <002b01d40ddc$2db8a9b0$8929fd10$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: he Thread-Index: AQG3MVG8I6UUkph7lmbqVgyvxU0ZTgITMJJbAid5fpqki351YA== Subject: RE: [PHP-DEV] [RFC] Deprecate and remove continue targeting switch From: vsuraski@gmail.com ("Zeev Suraski") > -----Original Message----- > From: Nikita Popov [mailto:nikita.ppv@gmail.com] > Sent: Tuesday, June 26, 2018 9:28 PM > To: Stanislav Malyshev > Cc: PHP internals > Subject: Re: [PHP-DEV] [RFC] Deprecate and remove continue targeting = switch >=20 > This RFC resolves the following issue: >=20 > 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. >=20 > 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. >=20 > 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). >=20 > 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. I think it would be helpful to gauge the levels of these bug reports to = understand whether it's worth the trouble. 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. Zeev