bearophile wrote:
In D1 I have written a very hairy (but not too much long) apply() function,
that given a function and some arguments, returns the result of the function
applied to them. (apply() is a basic higher-order thing common in most
functional languages).
So now I'm playing with this new toy of D2, not using it in a serious way yet,
and I have written:
import std.stdio: writeln;
auto apply(alias f, TyArgs...)(TyArgs args) {
return f(args);
}
void main() {
writeln( apply!( (x, y) { return x * y; } )(3, 4) );
}
But when I compile it the compile spits out at compile-time:
Assertion failure: '0' on line 935 in file 'glue.c'
Bye,
bearophile
Your code should work as expected. (Also, right off the bat, any
assertion failure in the compiler is a bug.) Could you submit to bugzilla?
Andrei