Date: Mon, 01 Jun 2026 18:39:48 +0000
On Monday, June 1st, 2026 at 7:43 AM, Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden]> wrote:
> So what is this feature good for? Well you can spontaneously lock a
> mutex at any point in a function:
>
> void Func(void)
> {
> if ( a )
> {
> if ( b )
> {
> if ( c )
> {
> %lock_guard{ my_global_mutex };
> }
> }
> }
>
> DoSomething();
> }
>
Python standard library offers an
ExitStack to address the demand.
The benefit of ExitStack is that,
since it creates yet another
variable, you can designate which
scope your `%` binds to. Maybe
you can repurpose goto labels for
this, but a library solution still
looks more powerful.
> So what is this feature good for? Well you can spontaneously lock a
> mutex at any point in a function:
>
> void Func(void)
> {
> if ( a )
> {
> if ( b )
> {
> if ( c )
> {
> %lock_guard{ my_global_mutex };
> }
> }
> }
>
> DoSomething();
> }
>
Python standard library offers an
ExitStack to address the demand.
The benefit of ExitStack is that,
since it creates yet another
variable, you can designate which
scope your `%` binds to. Maybe
you can repurpose goto labels for
this, but a library solution still
looks more powerful.
-- Zhihao Yuan, ID lichray The best way to predict the future is to invent it. _______________________________________________
Received on 2026-06-01 18:39:56
