The following ought to work, but it seems precompile.pike doesn't support varargs yet.
PIKECLASS foo { PIKEVAR program f;
// Note: args is a reserved variable name. PIKEFUN mixed `()(int ... arguments) { if (!THIS->f) Pike_error("...\n"); push_array_items(arguments); ref_push_program(f); f_call_function(arguments->size); stack_pop_n_elems_keep_top(args); } }
/ Henrik Grubbström (Lysator)
Previous text:
2003-03-13 13:12: Subject: .cmod
How do I write the following program as a .cmod?
class foo { program f;
mixed `()(int ...args) { return f(@args); } }
/ Niels Möller ()