Re: [RFC] Deprecate and remove continue targeting switch
| From: | Rowan Collins | Date: | Tue, 26 Jun 2018 20:49:29 +0000 |
| Subject: | Re: [RFC] Deprecate and remove continue targeting switch | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-102471@lists.php.net to get a copy of this message | ||
On 26/06/2018 20:28, niel wrote:
On 24/06/18 17:16, Nikita Popov wrote:Do you mean that this code would be valid in both PHP 7 and PHP 8, but mean different things? while($outer) {Hi internals, Another small deprecation for your consideration... https://wiki.php.net/rfc/continue_on_switch_deprecation Regards, NikitaIMO 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.
while($inner) {
switch($foo) {
case 1:
continue 2;
}
}
}
If so, I think that would be even more confusing.
Regards,
--
Rowan Collins
[IMSoP]