Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!odi!dlw From: dlw@odi.com (Dan Weinreb) Newsgroups: comp.object Subject: Re: Continuations Message-ID: <1989Dec1.232255.24662@odi.com> Date: 1 Dec 89 23:22:55 GMT References: <2664@bingvaxu.cc.binghamton.edu> <9624@pyr.gatech.EDU> <1623@odin.SGI.COM> <99894@ti-csl.csc.ti.com> <1989Nov29.230331.19595@odi.com> <7159@ficc.uu.net> Reply-To: dlw@odi.com Organization: Object Design, Inc. Lines: 31 In-Reply-To: peter@ficc.uu.net's message of 30 Nov 89 18:22:46 GMT In article <7159@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: In article <1989Nov29.230331.19595@odi.com> dlw@odi.com writes: > It depends what you mean. It would certainly be possible to invent a > definition of a language that was like C, but also had the features > needed to do continuation-style programming. There is. It's called C. Almost. Seriously. All you need to do is have a bit of unportable code that mucks around in struct jmp_buf. Save the stack between here and there, do a setjmp to mark the end of the current stack, and then longjmp back to the saved spot. To continue, restore the saved stack and longjmp back to the mark. It would be advisable to write this code in assembly language :->. This would also give you the ability to add coroutines, threads, and all sorts of other good stuff. Let's call it ++C. But it would not give me the ability to write programming that are in what is traditionally (at the MIT AI lab -- OK, I'm provincial, but that's where I was trained) referred to as continuation-passing style". When all the interesting papers about "continuation-passing style" were coming out at MIT in the late '70s, they showed a lot of very interesting techniques and things that you could do with continuations. But these techniques also employed funargs (both kinds). It's true that you could add the control structure all alone, and call what you get "continuation-passing style", but it would not be the style to which I had become accustomed. Obviously my posting was unclear because I had in mind this particular specialized meaning of the phrase "continuation-passing style", and I didn't explain what I meant. Sorry about that. Brought to you by Super Global Mega Corp .com