[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: callbacks

ramalho@gmail.com

11/28/2006 1:50:00 PM

On 11/28/06, gaurav bagga <gaurav.v.bagga@gmail.com> wrote:
> I was just going through mailing list posts i found word "callbacks" .
> was wondering whats a callback.

A callback is a callable object passed as an argument to a method.
This is often needed in event oriented programming. For exemple, when
building a GUI, whenever you instantiate a button you need to pass to
the constructor a method to be invoked when the button is clicked.

In Ruby, procs can be used for callbacks. You can find examples of
this in the Pickaxe Book, in this chapter:
http://www.rubycentral.com/book/e...

HTH.

Cheers,

Luciano