static switch

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Mar 5 14:58:00 PST 2014


On 3/5/14, 1:54 PM, Timon Gehr wrote:
> On 03/05/2014 07:58 PM, Andrei Alexandrescu wrote:
>> On 3/5/14, 10:45 AM, Dicebot wrote:
>>> On Wednesday, 5 March 2014 at 18:39:08 UTC, Andrei Alexandrescu wrote:
>>>> Doesn't enable anything. There'd be a ton more juice in a static
>>>> foreach; it would enable a lot of great idioms. We should pursue that
>>>> instead.
>>>>
>>>> Andrei
>>>
>>> Btw, are there any unexpected design difficulties with static foreach?
>>> Or it is just waiting for someone to do the pull request?
>>
>> The one difficulty is figuring how to allow for all iterations to stay
>> in the same scope, yet not have duplicate definitions of the iteration
>> symbol.
>
> static if needs exactly the same thing, currently the following compiles:
>
> static if(is(int A)){}
> A b; // meh

Good point, thanks!

Andrei



More information about the Digitalmars-d mailing list