Alternative Possibility - Implicit with

max haughton maxhaton at gmail.com
Sat Nov 19 16:25:46 UTC 2022


On Saturday, 19 November 2022 at 14:22:16 UTC, Paul Backus wrote:
> On Saturday, 19 November 2022 at 12:57:33 UTC, Adam D Ruppe 
> wrote:
>> Actually, I do wish `with` in general had a way to refer back 
>> to the subject of it. Maybe we could add something there then 
>> it'd magically apply to the implicit with too.
>
> Maybe something like this for symbols:
>
>     with (alias me = SomeReallyLongName)
>
> And this for expressions:
>
>     with (auto me = some(complex, ex + pression))
>
> Can be implemented by lowering to a normal block scope:
>
>     {
>         alias me = SomeReallyLongName;
>         with (me)
>         {
>             // ...
>         }
>     }

This + trailing with (a la `where`)


More information about the Digitalmars-d mailing list