caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kenneth Knowles <kknowles@uclink.berkeley.edu>
To: Ville-Pertti Keinonen <will@exomi.com>
Cc: Nuutti Kotivuori <naked+caml@naked.iki.fi>, caml-list@inria.fr
Subject: Re: [Caml-list] Python's yield, Lisp's call-cc or C's setjmp/longjmp in OCaml
Date: Tue, 16 Dec 2003 07:41:39 -0800	[thread overview]
Message-ID: <20031216154139.GA28283@tallman.kefka.frap.net> (raw)
In-Reply-To: <7CE71DB5-2FCE-11D8-90E3-000393863F70@exomi.com>


SML/NJ is a continuation-passing style compiler, so they are trivial.  It is
"possible, even in the presence of native compilation exceptions," but in a
traditiional call stack compilation it requires some sort of stack copying,
making them extremely inefficient.  (in SML/NJ every program is slower, while
continuations have almost no penalty)

There may be new tricks for avoiding copying of the whole stack, but I wouldn't
hold your breath for continuations in ocaml.

-Kenn

On Tue, Dec 16, 2003 at 03:48:11PM +0200, Ville-Pertti Keinonen wrote:
> 
> On Dec 16, 2003, at 3:13 PM, Nuutti Kotivuori wrote:
> 
> >I am wondering, does OCaml provide any variant of being able to
> >bypass the normal function call and return discipline?
> 
> There are many different things you could be referring to, some of 
> which OCaml does have (exceptions), some of which it doesn't 
> (coroutines, first-class continuations, generators etc.).
> 
> >And if not, what are the chances of something like that seeing the
> >light of day in the future? Are there any fundamental problems in
> >OCaml that would make the implementation of such a thing exceedingly
> >difficult?
> 
> First-class, capturable continuations are one of the things I often 
> wish OCaml had, but implementing them efficiently would require 
> significant changes to the execution model.
> 
> SML/NJ has efficient first-class continuations, so it's clearly 
> possible, even in the presence of native compilation and exceptions.
> 
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: 
> http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: 
> http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2003-12-16 15:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-16 13:13 Nuutti Kotivuori
2003-12-16 13:28 ` Oleg Trott
2003-12-18  0:15   ` Nuutti Kotivuori
2003-12-16 13:48 ` Ville-Pertti Keinonen
2003-12-16 15:41   ` Kenneth Knowles [this message]
2003-12-16 16:45     ` Richard Jones
2003-12-16 18:36       ` Ville-Pertti Keinonen
2003-12-16 18:42 ` Brian Hurt
2003-12-16 18:10   ` Dustin Sallings
2003-12-17  6:30     ` ijtrotts
2003-12-17  8:13       ` Dustin Sallings
2003-12-17 10:35       ` Falk Hueffner
2003-12-17 19:14         ` Pierre Weis
2003-12-17 19:32           ` Falk Hueffner
2003-12-17 20:04           ` David Brown
2003-12-18  1:14           ` Nicolas Cannasse
2003-12-18  5:31             ` David Brown
2003-12-18  7:05             ` Brian Hurt
2003-12-18  6:45               ` David Brown
2003-12-18 18:44             ` brogoff
2003-12-17 19:42         ` brogoff
2003-12-19 13:39           ` skaller
2003-12-18  0:51       ` Nuutti Kotivuori
2003-12-16 18:06 Kevin S. Millikin
2003-12-18 22:08 Ker Lutyn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031216154139.GA28283@tallman.kefka.frap.net \
    --to=kknowles@uclink.berkeley.edu \
    --cc=caml-list@inria.fr \
    --cc=naked+caml@naked.iki.fi \
    --cc=will@exomi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).