Hi,
Doing some tests, I discovered interesting behavior... Say, we have the following:
class Test {
string method(int n, string s)
{
// ...blabla
}
}
And some declarations:
Test typed = Test();
object untyped = Test();
So now, when I try to call typed->method(), the prototype will be checked,
but when I call untyped->method(), it won't (and all arguments will be 0).
As I understand, this is exactly because of absense of type declaration in
latter case, but... Is it intended to behave like this?
Sure, run-time prototype checking is expensive, but... It's absense may lead
to some strange application behavior, especially in C module (do I've to call
pop_n_elems(args) regardless of function prototype?). After all, it places
responsibility to check all arguments to the developer, explicitly (so it
has to be done anyway).
Concerning C modules... I have something like this:
void
object_match(INT32 args)
{
struct pike_string *s;
// ...
get_all_args("match", args, "%S", &s);
// ...
}
And prototype defintion like this (in pike_module_init()):
add_function("match", object_match, "function(string:int)", 0);
So, when this method is accessed through generic typed variable (object re)
without arguments, I get segfault in 7.5, while in 7.4 everything is OK
(error is thrown with no [visible] side effects).
I wonder what will happen if function will be called with arguments while
it accepts none (and there is no pop_n_elems(args) call)...
Do I do something wrong? Or this is a bug somewhere?
Regards,
/Al