Ceri Storey wrote: > I was just wondering if there any possibility of there being support > for continuations in a future version of ocaml? > > They'd be useful in all sorts of situations, eg: restarable network > protocol parsers, or co-routines. Continuations are nice ... but they need to save all the stack. This can be done in a reasonable way by saving only one page (or two if the first one is almost empty) of the stack and marking the other pages as unwritable and saving the next pages only when needed but: - This is not portable to all platforms (windows may be OK ?). - Intensive use of continuations are still time consuming. - Saving all the stack leads to important memory leaks because in general only some of the information in the stack are necessary to call the continuation and the other leads to useless pointer kept for the GC. It is in general better to implement yourself the bactracking you need by keeping a minimal record containing the information you need to backtrack and adding one argument (with such a list of records) to all the functions that may trigger backtracking. But, still, if you program well, and you know about the possible memory leaks, you can program with continuations and it is a pity they are not there in OCaml :-( Especialy for those (like me) who extract programs from classical proofs :-) -- Christophe Raffalli Université de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tél: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI --------------------------------------------- IMPORTANT: this mail is signed using PGP/MIME At least Enigmail/Mozilla, mutt or evolution can check this signature ---------------------------------------------