proposal: allow 'with(Foo):' in addition to 'with(Foo){..}'

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 10 10:23:02 PDT 2014


On 8/10/2014 1:29 AM, Brian Schott wrote:
> On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
>> No other statement construct works like that, there doesn't seem to be much
>> point to adding such a special case.
>
> ---
> static if (true):
>      alias A = B;
> ---
>
> ---
> static if (true)
>      alias A = B;
> else:
>      alias A = C;
>      alias D = E;
> ---

C:\cbx>type foo.d
void foo(int B, int C, int E) {
   static if (true)
     alias A = B;
   else:
     alias A = C;
     alias D = E;
}


C:\cbx>dmd -c foo
foo.d(4): Error: found ':' instead of statement


More information about the Digitalmars-d mailing list