/// return true if
/// a = b; // a: Afunc, b: Bfunc
/// won’t cause a compile error
fn match_function_type(Afunc: type, Bfunc: type) bool
simply Afunc == Bfunc is not all the cases.
by the way, is there a way to capture the compile error?
/// return true if
/// a = b; // a: Afunc, b: Bfunc
/// won’t cause a compile error
fn match_function_type(Afunc: type, Bfunc: type) bool
simply Afunc == Bfunc is not all the cases.
by the way, is there a way to capture the compile error?
You can check if the functions have the same function pointer type:
@TypeOf(&a) == @TypeOf(&b)
is there a way to capture the compile error?
What do you mean by “capture” here?
FWIW stuff like this will work and lets the compiler check for you:
fn callBoth(funcA: anytype, funcB: @TypeOf(funcA)) ...