It's declared as anytype. The sample usage seems to be a tuple. Is there a way to dynamically pass in argument values to the 'args' parameter of @call?
I'm trying to do dynamic dispatch. E.g.
fn foo(a: u8, b: i32) void {...}
fn bar(a: f64) void {...}
fn dispatch(func: anytype, json_args: []std.json.Value) !void {
// ... unpack json_args to .{arg1, arg2, ...}
@call(.auto, func, .{arg1, arg2, ...});
}
dispatch(foo, ...)
dispatch(bar, ...)