From: Justin Collins Date: 2006-10-28T05:38:58+09:00 Subject: Re: What are closures, continuations? Joe Ruby MUDCRAP-CE wrote: > I've seen these mentioned in various places. From what I can tell: > > - Ruby has closures -- which seem to be returning procs from functions? > - Continuations may be planned for a future release of Ruby. > > If anybody can elaborate/correct, please feel free! Also, how would each > be useful? > > Thanks, > Joe > Closures are tricky, but you can think of them as blocks of code, or a way of making code a first-class object. Or as anonymous functions. Or as lambdas. There is a lot of documentation on them, I'd start with the Pickaxe book if you have it, or the online version if you do not.[1] Then google for "ruby blocks" and read what you can find to clarify. Also search this list for past discussions. Continuations are currently available in Ruby[2], although, from what I understand, they are not widely used. There was a thread earlier about YARV (the "engine" for the next version of Ruby) not yet supporting continuations. That might be what you are thinking of. -Justin [1]http://ruby-doc.org/docs/ProgrammingRuby/html/tut_containers.html#UG [2]http://ruby-doc.org/core/classes/Continuation.html