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

via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 10 07:53:45 PDT 2014


On Sunday, 10 August 2014 at 12:34:47 UTC, Idan Arye wrote:
> On Sunday, 10 August 2014 at 08:29:14 UTC, Brian Schott wrote:
>> On Sunday, 10 August 2014 at 08:12:05 UTC, Walter Bright wrote:
>>> On 8/9/2014 1:04 PM, Timothee Cour via Digitalmars-d wrote:
>>>> See email: 'with(Foo):' not allowed, why? in 
>>>> 'digitalmars-d-learn at puremagic.com
>>>> <mailto:digitalmars-d-learn at puremagic.com>' forum
>>>> There's already an implementation proposed.
>>>
>>>
>>> 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;
>> ---
>
> Stop trying to turn D into Python. It's not gonna happen.

I think you misunderstand him: The examples he gave _are_ already 
valid in D, he's not proposing them. They work because `static 
if` is an attribute.


More information about the Digitalmars-d mailing list