Van Snyder sent the indented text:
>
[...]
>
> 1. In languages that support coroutines, there are typically two additional
> procedure invocation-related statements. In a Fortran extension, these
> might be COCALL and CORETURN. COCALL acts like a CALL if the procedure
> has never been called, or if it most recently returned by an ordinary
> RETURN statement. If it returned by a CORETURN statement, COCALL
> returns control to the procedure at the statement after the CORETURN
> statement. CALL always sends control to the first statement of the
> procedure.
>
> Best regards,
> Van Snyder
>
This is a great idea! We use reverse communication extensively, and
such a facility would make it much easier. I take it that coroutines
are not a new idea, but this is the first I've heard of them; I came
to computer programming through statistics. Anyhow, I like it!
We currently find it most convenient when writing reverse
communicating code to take all of the variables representing the
current state of the code, i.e. those one might otherwise apply a SAVE
statement to, and bundle them all up in a user-defined TYPE. Then
when the reverse communicating routine is called, it is called with
and argument of this TYPE. Of course, one still needs something like
a SELECT CASE statement or computed GO TO to get back to the right
place in the code. But using such a TYPE makes converting forward
communicating code to reverse communicating a lot easier. Also, when
you need multiple instantiations of the same reverse communicating
routine there is no need to pull the old trick of producing several
copies of the code which are identical except for their names; just
have several variables of this TYPE and use the appropirate one with
the same reverse communicating code.
I'd also like to point out that returning to the appropriate place in
reverse communicating code may call for a GO TO not just to branch to
the particular place, but if that place happens to be in a DO loop, an
IF THEN block, or similar place, then one *must* build these
constructs out of GO TOs, since it would otherwise be illegal to
branch into the body of a DO loop, for example.
--
John Jeffrey Venier, B.A., M.Stat. Programmer Analyst III
Section of Computer Science Department of Biomathematics
The University of Texas M. D. Anderson Cancer Center, Houston, Texas
[log in to unmask] +1 713 792 2622
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|