[log in to unmask] writes:
> As the ASSIGN operators were used only by programmers attempting to
> make code totally inscrutable, it may not be amenable to automatic
> translation.
This seems to have been the view of the Fortran 90 designers when they
made ASSIGN obsolescent. I don't use ASSIGN, but I would have used it
in the following case if it had not been obsolescent. I would be
interested to learn of an equally efficient and straightforward
alternative.
My program has a large number (several hundred) of shortish segments
of code that are sometimes needed, sometimes not. The ones that are
needed are evaluated many times in the course of one run of the
program. The routine that evaluates them (actually several routines
each dealing with a bunch of them) is handed an ordered list
specifying the items to be evaluated. I would have liked to label each
segment, ASSIGN the labels to an array segment(:) (this only needs to
be done once), and at the end of each segment find the next segment in
the list by
n=n+1; GOTO segment(list(n))
I don't think that this is at all inscrutable. I could even make the
labels match the segment numbers used in the list. Possible
alternatives: I could step through the code, testing before each
segment to see whether it's the next one to be evaluated. Since the
list is ordered, I only need one pass through the routine, but because
each segment of code is much less likely to be needed than not in any
given calculation, this is not very attractive. A binary chop search
would be more efficient, and I use something along those lines, but
it's very much clumsier to code.
--
Anthony Stone http://fandango.ch.cam.ac.uk/
University Chemical Laboratory, Email: [log in to unmask]
Lensfield Road, Phone: +44 1223 336375
Cambridge CB2 1EW Fax: +44 1223 336362
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|