# Can Scheme's call/cc implement all known control flow structures?

The page "Advanced Scheme: Some Naughty Bits" states:

Continuations are a powerful control-flow construct from which nearly any other control-flow structure [...] may be derived.

I thought that Scheme's call/cc, being related (*) to Peter Landin's J operator, could be used to implement any known control flow structure?

With "control flow structure" I'm specifically thinking about Wikipedia's description of them, e.g. exceptions, coroutines, green threads and so on.

Specifically, are there any examples of control flow structures that cannot be implemented using call/cc?

(*) I haven't been able to dig up any paper that establishes that call/cc is as powerful as the J operator. A paper by Felleisen (which I haven't read and admittedly have problems understanding it fully) investigates this, and seems to conclude that even though they are in different complexity classes, they are formally equivalent.

(Also note that I have updated the question based on the comments below)

Update

Based on the excellent answer by @Neel below, I've looked at sites commenting on delimited and undelimited continuations, and it does indeed seem that while call/cc, being undelimited, is not sufficient. Meanwhile, first-class, delimited continuations (like shift/reset) can be used, it seems, to express any control-flow structure.

-
What is the formal definition of a "control flow structure"? – Huck Bennett Feb 1 at 0:13
Re: undelimited continuations. Did you read the referenced paper by Hayo Thielecke? The actual claim is that undelimited continuations as provided by call/cc cannot express exceptions in the absence of state. (As Thielecke goes on to point out, exceptions can be implemented by passing around two continuations, one for the program and the other for the exception handler, but that requires more than just call/cc.) – rici Feb 1 at 2:47
@Rici: I only skimmed the first few pages. (Reading papers takes me a long time). Thanks for the comment! – csl Feb 1 at 8:37
@HuckBennett I don't have a formal definition, but informally I mean what it described at en.wikipedia.org/wiki/Control_flow -- specifically I mean that you can use continuations to express, and more importantly, to implement, coroutines, green threads, exceptions, escape-statements, the amb-operator, and so on. – csl Feb 1 at 8:56
@csl In addition to making more precise what "control flow structure" means, you also need to be more clear what it means to "express" something. This is a difficult problem, and the answer to your question depends strongly on what you count as expression. After all, you can always somehow code up a Turing machine which encodes an interpreter of a language with exceptions (e.g. Java). But that's probably not what you have in mind, so you need to put strong constraints on the concept of "expression" (e.g. compositionality and/or full abstraction). – Martin Berger Feb 1 at 14:02
show 1 more comment