Paul Johnston
2008-Aug-08 22:47 UTC
[Eventmachine-talk] EventMachine::cancel_timer(signature)
I don''t understand the rationale for making EventMachine::cancel_timer a private class method (version 0.12, eventmachine.rb, line 340). If the signature is exposed as the return value of calling add_timer, why not let the user make some use of it? I''m aware I can create a Timer directly (http://rubyforge.org/pipermail/eventmachine-talk/2007-December/001269.html), but then I''m responsible for maintaining a reference to the Timer object rather than the signature. I can workaround it, just interested in the design choice. Thoughts appreciated. Paul Johnston
Aman Gupta
2008-Aug-09 15:06 UTC
[Eventmachine-talk] EventMachine::cancel_timer(signature)
I''m not sure why cancel_timer is private, but you can always do: EM.__send__(:cancel_timer, timer_sig) Probably does make a lot more sense as a public method though. Would you mind opening a ticket on the Trac (http://rubyeventmachine.com/ newticket) Aman On Aug 8, 10:47?pm, "Paul Johnston" <pcj... at gmail.com> wrote:> I don''t understand the rationale for making EventMachine::cancel_timer > a private class method (version 0.12, eventmachine.rb, line 340). ?If > the signature is exposed as the return value of calling add_timer, why > not let the user make some use of it? > > I''m aware I can create a Timer directly > (http://rubyforge.org/pipermail/eventmachine-talk/2007-December/001269...), > but then I''m responsible for maintaining a reference to the Timer > object rather than the signature. ?I can workaround it, just > interested in the design choice. > > Thoughts appreciated. > > Paul Johnston > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-t... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/eventmachine-talk
Brian Takita
2008-Aug-09 15:18 UTC
[Eventmachine-talk] EventMachine::cancel_timer(signature)
On Sat, Aug 9, 2008 at 3:06 PM, Aman Gupta <themastermind1 at gmail.com> wrote:> I''m not sure why cancel_timer is private, but you can always do: > > EM.__send__(:cancel_timer, timer_sig)You can also do: module EventMachine public :cancel_timer end to avoid needing to use #__send__.> > Probably does make a lot more sense as a public method though. Would > you mind opening a ticket on the Trac (http://rubyeventmachine.com/ > newticket) > > Aman > > On Aug 8, 10:47 pm, "Paul Johnston" <pcj... at gmail.com> wrote: >> I don''t understand the rationale for making EventMachine::cancel_timer >> a private class method (version 0.12, eventmachine.rb, line 340). If >> the signature is exposed as the return value of calling add_timer, why >> not let the user make some use of it? >> >> I''m aware I can create a Timer directly >> (http://rubyforge.org/pipermail/eventmachine-talk/2007-December/001269...), >> but then I''m responsible for maintaining a reference to the Timer >> object rather than the signature. I can workaround it, just >> interested in the design choice. >> >> Thoughts appreciated. >> >> Paul Johnston >> _______________________________________________ >> Eventmachine-talk mailing list >> Eventmachine-t... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/eventmachine-talk > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk >
Paul Johnston
2008-Aug-09 22:01 UTC
[Eventmachine-talk] EventMachine::cancel_timer(signature)
On Sat, Aug 9, 2008 at 3:18 PM, Brian Takita <brian.takita at gmail.com> wrote:> On Sat, Aug 9, 2008 at 3:06 PM, Aman Gupta <themastermind1 at gmail.com> wrote: >> I''m not sure why cancel_timer is private, but you can always do: >> >> EM.__send__(:cancel_timer, timer_sig) > You can also do: > module EventMachine > public :cancel_timer > end > > to avoid needing to use #__send__. >>Thanks, those are both good solutions.>> Probably does make a lot more sense as a public method though. Would >> you mind opening a ticket on the Trac (http://rubyeventmachine.com/ >> newticket) >> >> Aman >> >> On Aug 8, 10:47 pm, "Paul Johnston" <pcj... at gmail.com> wrote: >>> I don''t understand the rationale for making EventMachine::cancel_timer >>> a private class method (version 0.12, eventmachine.rb, line 340). If >>> the signature is exposed as the return value of calling add_timer, why >>> not let the user make some use of it? >>> >>> I''m aware I can create a Timer directly >>> (http://rubyforge.org/pipermail/eventmachine-talk/2007-December/001269...), >>> but then I''m responsible for maintaining a reference to the Timer >>> object rather than the signature. I can workaround it, just >>> interested in the design choice. >>> >>> Thoughts appreciated. >>> >>> Paul Johnston >>> _______________________________________________ >>> Eventmachine-talk mailing list >>> Eventmachine-t... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/eventmachine-talk >> _______________________________________________ >> Eventmachine-talk mailing list >> Eventmachine-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/eventmachine-talk >> > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk >