If I have a common function signature I'm using throughout my code, and I feel like there should be a way to condense it using a macro. The intuitive method isn't working, but this seems like something D would be able to do. What've I got wrong in this example?


alias somelongsignature = int(in int x);

int examplefunc0(in int x){
    return x * 2;
}

somelongsignature testfunc0 = examplefunc1;
somelongsignature testfunc1 = somelongsignature {return x + 3};

public void main(){
    import std.stdio;
    writeln(testfunc0(5)); // Should output 10
    writeln(testfunc1(5)); // Should output 8
}



Thanks!

Reply via email to