New feature proposal: "initialization scope"

bearophile bearophileHUGS at lycos.com
Thu May 16 03:20:39 PDT 2013


TommiT:

> If I needed to initialize only one const variable, I could use 
> a lambda:
>
> const string[100] int__str = {
>     string[100] tmp;
>     // ... init tmp ...
>     return tmp;
> }();
>
> ...But I can't see any easy solution for initializing two or 
> more const variables at the same time.

Once we have a tuple unpacking syntax, you return and assign to 
two const variables at the same time.

Bye,
bearophile


More information about the Digitalmars-d mailing list