Re: [RFC] Context Managers

From: Date: Wed, 08 Apr 2026 17:02:32 +0000
Subject: Re: [RFC] Context Managers
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-130591@lists.php.net to get a copy of this message
On 8 April 2026 17:07:38 BST, Larry Garfield <larry@garfieldtech.com> wrote: >Switch being considered a looping structure does qualify as a "quirk" in my book. I had a look at really old code on https://museum.php.net and from what I can make out, PHP/FI 2.0 had single-level "break" only as part of the "switch" syntax; there was no way to terminate loops early. PHP 3.0 added a general-purpose "break" and "continue", with both keywords taking an optional argument - in fact, both were implemented by the same C function. The existing use of "break" for switch statements just became part of this more general feature. I guess you could argue that that means "treating switch as a looping construct", but I honestly can't think what the alternative would have been, other than using a different keyword. If PHP has a "quirk" it is that "break" and "continue" both take a numeric argument. Any new use of either keyword would need to deal with that quirk, even if "switch" was removed from the language completely. Rowan Tommins [IMSoP]

« previous php.internals (#130591) next »