As others have noted, the article in question does not actually
address Fortran at all, and all the advice given can be applied
to Fortran as easily as any other language. However, there is
one part of his advice that's actually bad, at least for a language
like Fortran. He notes the following is hard to read:
Can(you, tell, at + a, glance, which * of, these,
parameters, is(the, eighth), one ? yeah : sure);
He the follows with the advice:
When you have this many parameters, it's probably
time to switch to an interface that passes a record rather
than individual parameters.
But, this would cause the semantics of the call to change
from using whatever parameter passing protocol the language
uses and forcing the equivalent of copy-in (and maybe copy-out).
Sure, you can force the programmer to write:
arg.first = you;
arg.second = tell;
arg.third = at+a;
arg.fourth = glance;
arg.fifth = which * of;
arg.sixth = these;
arg.seventh = parameters;
arg.eighth = is(the, eighth);
arg.ninth = one ? yeah : sure;
Can(arg);
And then after the call "Can(arg);" you would maybe have to
copy results back out of the "arg" variable (C is call by value,
so there wouldn't be any results returned, but this discussion is
supposed to apply to lots of languages).
However, in a language like Fortran, a more legible and usually
more efficient way would be:
Call Can(first=you, second=tell, third=at+a, fourth = glance, &
fifth = which * of, sixth = these, seventh = parameters, &
eighth = is(the, eighth), ninth = one ? yeah : sure)
Of course, the argument names would probably be chosen (in both
styles) to be more mnemonic. But Fortran allows preservation of
the language's usual parameter passing rules instead of requiring
copies. And, it's more legible.
--
J. Giles
"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare
|