D1 -> D2

Fawzi Mohamed fawzi at gmx.ch
Fri Nov 19 04:02:58 PST 2010


On 19-nov-10, at 08:44, Walter Bright wrote:

> Fawzi Mohamed wrote:
>> I don't find a valid D1 expression to put in place of scope, or to  
>> somehow hide it, i.e. how do you write something like
>> module t;
>> void f(scope void delegate() action){
>>    action();
>> }
>> void main(){
>>    f(scope delegate(){
>>        printf("bla\n");
>>    });
>> }
>> so that it is valid D1 and D2?
>
> Just remove the 'scope'.
removing scope causes heap allocation in D2 that I want to avoid.
Still maybe you are right, I will use /+scope+/, so that one has  
something working, and easily go to the efficient D2 version


More information about the Digitalmars-d mailing list