undocumented inconsistency in call signatures (was Re: timeouts)



I just looked at the bindings to answer a question and notice an undocumented
inconsistency between Gtk2-Perl and C function reference.  We are using one
function -- g_timeout_add -- instead of two -- g_timeout_add and
g_timeout_add_full.  This can cause confusion (as it did briefly for me) when
you want to set the priority of a timeout to something other than the default
piority.  I am not certain, but I think (Gtk-Perl did it this way) it could also
cause confusion for a person trying to pass a list into his or her timeout:

What is intended:
Glib::Timeout->add(
        500,             #every half second (about)
        \&sub,           #execute this subrouting
        3000, 4000, 6000 #with these args in @_
);

What happens:
Glib::Timeout->add(
        500,      #every half second (about)
        \&sub,    #execute this subrouting
        3000,     #with this arg in $_[1]
        4000,     #at priority 4000 (really, really low) 
        6000      #ignored
);

What the person should currently do:
Glib::Timeout->add(
        500,                 #every half second (about)
        \&sub,               #execute this subrouting
        [ 3000, 4000, 6000 ] #with these args in @{$_[0]}
);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]