Multiple function prototype declarations

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Multiple function prototype declarations

Stephen R. van den Berg
I seem to recall that in C, one can define multiple function declarations
for the same function.
Is it possible to do the same at Pike level?

Example, I have a function declared as void foo(mixed ... bar);
Now I want to check, and enforce two different declarations:

void foo(string s, mixed ... bar);
void foo(function f, string s, mixed ... bar);

Can I, at Pike level, declare somehow that the above two prototypes
are the only two valid prototypes for this function?
So that Pike will give me a syntax error if I try to do foo(23); ?