Path: news.cs.au.dk!not-for-mail From: Flemming Gram Christensen Newsgroups: comp.lang.beta Subject: Re: More newbie: suspend Date: 02 Jun 2000 11:54:33 +0200 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 76 Message-ID: References: <39368951.3F2E3D5D@skynet.be> NNTP-Posting-Host: odin.mjolner.dk X-Trace: xinwen.cs.au.dk 959939674 16868020 255.255.255.255 (2 Jun 2000 09:54:34 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 2 Jun 2000 09:54:34 GMT X-Newsreader: Gnus v5.7/Emacs 20.4 Xref: news.cs.au.dk comp.lang.beta:12382 Atle writes: > > Activity: > (# > do cycle > (# > do > GetOrder; suspend; > ProcessOrder; suspend; > DeliverOrder; suspend; > #) > #) > > Now, the document speaks about A and B being instances of this, and invoked as > > cycle(#do A; .... B; .... #) > > I am i n deep s<< > A.Getorder > B.Getorder > A.ProcessOrder > B.ProcessOrder > A.DeliverOrder > B.DeliverOder > A.Getorder Yes that will be the order. I suppose A and B are declared as A:@|Activity; The suspend in A will continue execution at the first '...'s in the last cycle(# .. #); > > ... and so on! Eh is this right (Y/N)? > > Next: suspend. > > Unfortunately, I know suspend in the form suspend X, where X is a variable, from Icon. Can anyone explain the difference between the Icon suspend and the BETA? > > When a generator (coroutine) suspends, will there be a legal value in the exit variable, will it be updated on each invokation? The exit variable is not a special variable, it is a normal attribute of the object (or component). Note you are not restricted to simple variables in the exit parts. You can write general expressions: p: (# a,b,c:@integer; enter (a,b,c) do ... exit (a+c,(# d:@integer; do a+b->d; d*3->d exit d#), (a,b)->max) #); But this is not very used. > > Is there an easy-to-follow declarative program that uses coroutines as generators, so I can get this straightened out in my > (somewhat confused) head? Look into beta/demo/basiclib/systemenv/. There are demos there. eg. pipe.bet or masterSlave. buffer.bet is probably the easiest. /Flemming Gram Christensen ------------------------------------------------------------------------ Mjolner Informatics ApS Phone: +45 86 20 20 00 Science Park Aarhus Fax: +45 86 20 12 22 Gustav Wieds Vej 10 DK-8000 Aarhus C Denmark E-mail: gram@mjolner.dk ------------------------------------------------------------------------