Multi-shot continuations gone forever?

It looks like ocaml-multicont tries to make it easy to mix linear-continuations and multishot-continuations in the same code. My experience was that this always blew up in my face.

(As @dhil surely knows, but for context:) As soon as “multishot effects” get nested (which is very soon when they are used for backtracking), the operation “inside” cannot safely by handled using linear continuations, as its handling logic may be resumed several times by the operation “outside” – this is the essence of the clone_is_tricky example.

Unless I missed something, the robust way to write handlers for nestable multishot operations is to assume that all continuations can be resumed several times. At the time of my experiments, that meant constantly using Obj.clone_continuation before continuing the (copy of the) continuation. In your library, I guess that would mean very careful to use only (multishot) resumptions, and never (linear) continuations. So I’m not sure what is the use-case for mixing both styles together.

1 Like