From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA29846; Tue, 16 Dec 2003 16:44:06 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA29904 for ; Tue, 16 Dec 2003 16:44:05 +0100 (MET) Received: from localhost (adsl-64-162-212-212.dsl.snfc21.pacbell.net [64.162.212.212]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hBGFi4H08310 for ; Tue, 16 Dec 2003 16:44:04 +0100 (MET) Received: by localhost (Postfix, from userid 1000) id 1EF496A4E6C; Tue, 16 Dec 2003 07:41:39 -0800 (PST) Date: Tue, 16 Dec 2003 07:41:39 -0800 From: Kenneth Knowles To: Ville-Pertti Keinonen Cc: Nuutti Kotivuori , caml-list@inria.fr Subject: Re: [Caml-list] Python's yield, Lisp's call-cc or C's setjmp/longjmp in OCaml Message-ID: <20031216154139.GA28283@tallman.kefka.frap.net> References: <87n09sucr9.fsf@naked.iki.fi> <7CE71DB5-2FCE-11D8-90E3-000393863F70@exomi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7CE71DB5-2FCE-11D8-90E3-000393863F70@exomi.com> User-Agent: Mutt/1.5.5.1i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; knowles:99 caml-list:01 python's:01 lisp's:01 c's:01 slower:01 avoiding:01 breath:01 coroutines:01 model:01 bug:01 faq:01 faq:01 beginner's:01 beginners:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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