Arc Forumnew | comments | leaders | submitlogin
1 point by conanite 5579 days ago | link | parent

On top of that, while we're on the topic, I don't know what happens if you jump into another continuation in the following circumstances:

1. you're inside atomic-invoke, call-w/stdout, call-w/stdin, or anything that creates context that needs to be undone on the way out. The problem is that a continuation from in here can be exited multiple times although it was entered only once.

2. similarly, you're inside protect, (equivalent to "finally" in java) - is the "after"-fn called, and if so, only once or for each re-entered continuation?

3. the continuation you jump into was originally running on another thread.

I should write tests to figure out what happens in all these cases, but if anybody knows the answers I can live with being lazy :)

With all these questions, I can only echo fallintothis' remark that continuations are notoriously difficult to explain, and while they make for some great intellectual amusement (see Mondo Bizarro - http://arcfn.com/2008/03/arc-continuation-puzzle.html and http://arcfn.com/2008/03/continuations-made-difficult.html ), they're not practical for everyday coding.



1 point by tumult 5577 days ago | link

This is what dynamic-wind is for. http://docs.plt-scheme.org/reference/cont.html#(def._((quote...)

(dynamic-wind is one of the coolest things ever)

-----