Now I implemented call/cc in a probably bad ways (CSP) so fast versions probably introduces context too. since this is just copying the activation stack and jumping to it.
Do you mean CPS/continuation passing style?
yes but this was a stupid and simple implementation of a simple scheme. Just plain boring to debug but nothing fancy.
I've been thinking about how to do CPS on Smalltalk, these past few weeks, precisely for (delimited) continuations.
I think that if this is not done automatically by program transforamtion you end up creating ugly code.
I'd like to contrast the technique with my current implementation, using exceptions. How are you finding it?
Delimited continuations are superior to call/cc at any rate: it's trivial to express call/cc in terms of delimited continuations (wrap your entire process in a prompt and you're done), but the converse isn't true. You can fake delimited continuations a la call/cc + mutable cell, but it's messier. Also, undelimited continuations can't be treated like functions, and can't compose. Oleg Kiselyov's written a fair about the issue, and continuations in general:
* http://lambda-the-ultimate.org/node/4313 * http://okmij.org/ftp/continuations/undelimited.html * http://lambda-the-ultimate.org/node/86 * http://okmij.org/ftp/continuations/index.html
I'm sorry I did that nearly 10 years ago just for fun and a lecture so I forgot :) Now I do not know delimited continuations Stef
frank
Q1 When are they absolutely required? Q2 What replacing mechanisms would be needed? Q3 What would we gain from an implementation stand point?
Some simplicity, certainly. But (IMO) ^-return isn't as complex as method lookup and message cacheing so you're not reducing complexity overall.
It seems that in resilience lars removed them and more.
Yes, IIRC he got rid of first-class blocks. They can only be downward funargs (passed as parameters), not upward funargs (stored in inst vars, returned as results and hence used after their enclosing activation has returned).
Yes exactly. So I wanted to know if removing ^- was like removing upward funargs.
Stef
for Q1 I see
foo x isZero ifTrue: [^ 33]. self continue
-- best, Eliot