[LRUG] Continuations

Piers Cawley pdcawley at bofh.org.uk
Thu Mar 15 09:52:17 PDT 2007


Eleanor <eleanor at goth-chic.org> writes:

> On 15 Mar 2007, at 09:33, Piers Cawley wrote:
>> So, on the train back on Wednesday I thought of a way of explaining
>> continuations. This morning, I finally wrote it up as a blog post:
>>
>> http://www.bofh.org.uk/articles/2007/03/15/the-commenting-problem
>
> Funnily enough I've recently been chatting on the Unicon mailing list  
> about some of the features of (Un)Icon that I miss in Ruby. The most  
> significant of these is an expressive syntax for goal-direction/back- 
> tracking (i.e. continuations). Callcc provides the basic facility,  
> but in Icon you have co-routines, proper generators that suspend,  
> generalised expression failure, back-tracking and... well lots of  
> stuff that would make an excellent addition to Ruby - or at least a  
> handy DSL.

I seem to recall that continuations and coroutines are equivalent; you
can implement one in terms of the other. 

> I know many of these things can be done in Ruby, but there's nothing  
> quite as pleasant as having the details taken care of by the language  
> itself :)

I think the issue is that Ruby's syntax isn't particularly
malleable. So you can implement (say) a lazy list generator, but you
then can't rejig the parser to let you hide the scaffolding.


-- 
Piers Cawley <pdcawley at bofh.org.uk>
http://www.bofh.org.uk/



More information about the Chat mailing list