implicit-context v0.0.1

Guillaume Piolat first.name at gmail.com
Tue Oct 3 10:23:00 UTC 2023


On Monday, 2 October 2023 at 19:04:19 UTC, MrSmith33 wrote:
> On Thursday, 28 September 2023 at 23:28:02 UTC, Guillaume 
> Piolat wrote:
>> - manual push/pop
>
> I wonder if `with` statement is helpful here to reduce verbosity

Do you mean with:

     with(scopedContext())
     {
         set!int("myVar", 5);
     }

     ScopedContext scopedContext() { /* blah */ }

     struct ScopedContext
     {
         ~this() { context.pop; }
     }


Because at a point there was such a RAII context wrapper. I 
didn't realize, `with` extends its lifetime to the scope?


More information about the Digitalmars-d-announce mailing list