Re: undocumented inconsistency in call signatures (was Re: timeouts)
- From: "muppet" <scott asofyet org>
- To: gtk-perl-list gnome org
- Subject: Re: undocumented inconsistency in call signatures (was Re: timeouts)
- Date: Thu, 11 Sep 2003 13:12:37 -0400 (EDT)
Chas Owens said:
What is intended:
Glib::Timeout->add(
500, #every half second (about)
\?, #execute this subrouting
3000, 4000, 6000 #with these args in @_
);
What happens:
Glib::Timeout->add(
500, #every half second (about)
\?, #execute this subrouting
3000, #with this arg in $_[1]
4000, #at priority 4000 (really, really low)
6000 #ignored
);
actually, that 6000 should not be ignored --- you should get a "usage"
warning, because you are attempting to pass too many parameters.
What the person should currently do:
Glib::Timeout->add(
500, #every half second (about)
\?, #execute this subrouting
[ 3000, 4000, 6000 ] #with these args in @{$_[0]}
);
this is correct. gtk-perl allowed you to pass as many elements as you liked
through the user_data field. gtk2-perl explicitly breaks compatibility with
that, and passes only a single scalar element for user data.
the idea behind using one function instead of two in the bindings is that the
_full forms in the C API are usually things that could be avoided if C allowed
default parameters; perl does, so ... well, you know.
--
muppet <scott at asofyet dot org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]