Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Caml-list] Delimited continuations in OCaml go to 3.12 and 64

31 views
Skip to first unread message

ol...@okmij.org

unread,
Aug 22, 2010, 9:35:40 PM8/22/10
to caml...@inria.fr

The library delimcc implements multi-prompt delimited control operators
for byte- and native-code OCaml. The library now can be used with
OCaml 3.12.0, on x86_32 and x86_64 (aka amd64) platforms.

The byte-code part of the previous versions of delimcc could
already be used with OCaml 3.12 (although I didn't know that). Since
OCaml byte-code is portable, the byte-code delimcc should work on
any supported architecture. In this version, some adjustments have
been made to scAPI to make in more portable. It should be stressed
that there are _no_ distinct versions of the native-code delimcc, for
32- and 64-bit architectures. Rather, the same code (without any
64-bit--specific ifdefs) works on x86_32 and x86_64. Only
C code differs between byte-code and native-code versions of the
library; the OCaml code is shared, across the versions and the
architectures. The current version of delimcc probably works on other
architectures like arm, although I have no means of testing that.

The byte- and native-code versions of library has been tested on i386
Linux and FreeBSD platform and on amd64 Linux platform. The code is at

http://okmij.org/ftp/continuations/caml-shift.tar.gz

I thank Jim Pryor for help with testing.

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Yoann Padioleau

unread,
Aug 23, 2010, 5:38:40 PM8/23/10
to ol...@okmij.org, caml...@inria.fr

Is there any tutorial on why such features are useful ?
Concrete examples of their use. For instance can you implement
python generators and its yield stuff by using this library ?

The only reference mentioned in the source is a technical report that
does not look very easy to read.

Jake Donham

unread,
Aug 23, 2010, 9:21:11 PM8/23/10
to Yoann Padioleau, ol...@okmij.org, caml...@inria.fr
On Mon, Aug 23, 2010 at 2:38 PM, Yoann Padioleau <pad...@wanadoo.fr> wrote:
> Is there any tutorial on why such features are useful ?
> Concrete examples of their use. For instance can you implement
> python generators and its yield stuff by using this library ?

Here is an example of a particular use of Delimcc to implement fibers for Lwt:

http://ambassadortothecomputers.blogspot.com/2010/08/mixing-monadic-and-direct-style-code.html

I don't know exactly how python generators work but I would imagine
that you can implement them with Delimcc.

Jake

ol...@okmij.org

unread,
Aug 24, 2010, 2:53:55 AM8/24/10
to pad...@wanadoo.fr, caml...@inria.fr

Yoann Padioleau wrote:
> Is there any tutorial on why such features are useful ?
> Concrete examples of their use.

Thank you for the question! I think you may find many examples
of delimited continuations on the following web site:
http://okmij.org/ftp/Computation/Continuations.html

Notable examples are the probabilistic programming language HANSEI,
normalization of MapReduce bodies by evaluation, and a framework to
program CGI applications in `direct style' (as if they were regular
console applications). Delimited continuations proved quite useful for
writing code generators: to perform let- or if-insertions in the
generated code, one has two choices: write the generator in a monadic
style or CPS, or use a `direct style' relying on delimited
control. Experience seems to show that direct-style generators are
more perspicuous.

> For instance can you implement python generators and its yield stuff
> by using this library ?

Yes! Here is the complete code
http://okmij.org/ftp/ML/generator.ml

0 new messages