From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA03887 for caml-redistribution; Fri, 9 May 1997 09:50:29 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id DAA00110 for ; Fri, 9 May 1997 03:34:46 +0200 (MET DST) Received: from www.nextsolution.co.jp (news.nextsolution.co.jp [202.33.245.114]) by nez-perce.inria.fr (8.8.5/8.7.3) with SMTP id DAA13683 for ; Fri, 9 May 1997 03:34:42 +0200 (MET DST) Received: from sparc3.co.jp (sparc3 [202.235.80.3]) by www.nextsolution.co.jp (SMI-8.6/) with ESMTP id KAA23934 for ; Fri, 9 May 1997 10:33:21 +0900 Received: by sparc3.co.jp (SMI-8.6/SMI-SVR4) id KAA00380; Fri, 9 May 1997 10:35:47 +0900 Date: Fri, 9 May 1997 10:35:47 +0900 Message-Id: <199705090135.KAA00380@sparc3.co.jp> From: Frank Christoph MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: caml-list@inria.fr Subject: continuations In-Reply-To: <199705071624.LAA29105@kimbark.uchicago.edu> References: <199705071624.LAA29105@kimbark.uchicago.edu> X-Mailer: VM 6.22 under 19.15 XEmacs Lucid Sender: weis >>>>> "Lyn" == Lyn A Headley writes: > hi, I was reading an article about language implementation in Standard ML > (slightly annoying name isn't it?) which described a continuation-passing > interpreter. It seems that in sml, continuations are simply unit -> unit > functions. So it seems that any language with higher-order functions is > capable of passing continuations. This is not the impression I get from the > Scheme camp, who seem to think that continuations are a special form that > only a few almighty languages support. Anyone know the full story? It doesn't take any special facility to use continuations if you are writing in CPS (continuation-passing style) or monadic style; either technique can be used in any functional language. For example, functional parsers are often written in this way. On the other hand, if you want to be able to capture the current continuation in a functional language in any piece of code (i.e., in so-called direct style), the interpreter or compiler has to be able to save the current context, duplicate it, discard it and reinstate it later on. Compilers or interpreters that support that are said to support first-class continuations. It turns out that in fact the New Jersey implementation of SML does have first-class continuations; I believe they are typed as "'a cont", where "cont" is a special type constructor that is hard-wired into the language. Any good book on functional programming will outline at least the basics of continuation-passing style, but books that use Scheme make more frequent use of them because Scheme happens to be the a language that supports first-class continuations. (In fact, you can make a good case that any eager language should support them.) -- Frank Christoph Next Solution Co. Tel: 0424-98-1811 christo@nextsolution.co.jp Fax: 0424-98-1500