Not sure about continuations, but I'll have a stab at co-routines.
Co-routines consist of two processes, each with it's own state and executing quasi concurrently.
An example might be a producer and consumer process pair. Say
P =()=> Q where they are connected via a stream.
The process Q will block until P writes something to the stream. P's writing can be made either synchronous or asynchronous. Q is said to be re-entrant, as it preserves it's state between invocations.
To implement this in Smalltalk you would have two processes, the scheduling of which would be controlled by a Semaphore. See SharedQueue. Using COBOL (what!?) you would need to separate out the state and have a goto to the particular resume point in the code, depending on it's previously suspended state.
Hope this helps,
Stewart
OK, I'll exhibit my ignorance :-). What are continuations, and what are they useful for? Same questions for coroutines.
Bob Jarvis Compuware @ Timken
-----Original Message----- From: Vassili Bykov [SMTP:vassili@objectpeople.com] Sent: Thursday, January 27, 2000 8:19 AM To: squeak@cs.uiuc.edu Subject: RE: Multiple Returns, was Re: Common Lisp style
macros in
Smalltalk?
From: demiourgos@smalltalk.org [mailto:demiourgos@smalltalk.org] But I have wondered from time to time -- not having deep
process-based
experience in Smalltalk (applications instead) -- how one
might go about
implementing coroutines or continuations in the manner of
Scheme. Or
are these things too far out of the Smalltalk model?
I implemented continuations for Squeak a couple of year ago. Nobody seemed particularly impressed, so even if they are not far out of
the Smalltalk
implementation, they are far out of the Smalltalk thinking.
--Vassili
squeak-dev@lists.squeakfoundation.org