Can the compiler optimize the delegates (foo) to form an inline code, or the 
mixin version is prefered?

module a;

import std.stdio;

void foo2( string s )()
{

        for( int i = 0 ; i < 10; i++ )
        {
                mixin( s );
        }               
}

void foo( void delegate(int) pDg )
{
        for( int i = 0 ; i < 10; i++ )
        {
                pDg( i );
        }               
} 

void main()
{
        foo( (int a){ writeln( a ); } );
        foo2!("writeln( i );")();
}

Thank you 1

Reply via email to