On Wed, May 6, 2026, at 8:31 AM, Côme Chilliet wrote:
> Le 22 avril 2026 20:28:15 GMT+02:00, Larry Garfield
> <[email protected]> a écrit :
>>I will stop here, however, and ask for input from the audience. (Not just
>>the regulars in this thread of late, but all of you reading this.) Including
>>if you have an alternate approach to the three listed above that would have
>>notably fewer cons.
>>
>>--Larry Garfield
>
> I prefer the void return and throw if needed approach, it looks way
> more understandable. I was confused by that part when reading the RFC
> and really surprised that returning an Throwable on success is ignored,
> which is not clear at all when reading the interface.
By which you mean the "if you do nothing, the exception is swallowed" approach?
(IE, more work in the common case.)
My reluctance there is that it will become really easy to forget to propagate.
public function exitContext(?Throwable $e) {
fclose($this->fp);
}
That seems like it should be all you need, but it will also silently swallow
any errors, so whatever code uses this context manager won't know if it was
successful or not. That seems not-great to me.
> The in-out parameter works too but is a bit weirder, and makes it
> unclear what happens if exitContext throws.
>
> It's also unclear to me in the current desugarized version what happens
> when exitContext throws, the reset of the context var does not happen ?
> There is nothing to handle that.
>
> Côme
We'll have to clean up the desugared versions once we decide what they should
actually be. :-) There's probably a bug in there at the moment.
--Larry Garfield