Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!xylogics!world!burley From: burley@world.std.com (James C Burley) Newsgroups: comp.lang.fortran Subject: Re: Function calls in the middle of subroutine CALLs? -- Is it standard fortran 77 ???? Message-ID: Date: 21 Jul 90 07:15:45 GMT References: <6381@helios.TAMU.EDU> <1990Jul19.014856.13421@maytag.waterloo.edu> <5283@milton.u.washington.edu> <8768@ubc-cs.UUCP> Sender: burley@world.std.com (James C Burley) Organization: The World Lines: 35 In-Reply-To: buckland@cheddar.ucs.ubc.ca's message of 19 Jul 90 20:27:15 GMT In article <8768@ubc-cs.UUCP> buckland@cheddar.ucs.ubc.ca (Tony Buckland) writes: A pity. Many years ago when FORTRAN meant FORTRAN-IV, I wrote a package of functions to perform pieces of a task (string decomposition and manipulation, if you must know) as functions just so that I could achieve the compactness of R = ONE(A,B)+TWO(A,B,C)+THREE(A,C)+FOUR(A) Where R is a more-or-less useless result and the statement really means "do thing 1 to arguments A and B, then do thing 2 to A, B and C, then ..." where A, B, C were modified by the operations and order mattered very much. Nevermore; sigh. It is nice to be able to express things like this compactly, but this isn't what Fortran has ever been intended to provide, especially because it looks (and is) rather difficult to maintain, since technically ONE through FOUR must be written as functions when they would appear (to somebody just looking at them) to operate usefully only as subroutines. For this kind of compactness, C has the comma operator to indicate both ordering of operations (left to right) and return the final expression. Sure it's useful in some cases, but not for the kind of programming Fortran people usually want to do. And since C has free-form syntax and no CALL keyword, "r = one(a), two(b), three(c), four(d);" is actually less compact and readable than the (equivalent if you discard "r") statements "one(a); two(b); three(c); four(d);". In Fortran 90, you could at least write: CALL ONE(A); CALL TWO(B); CALL THREE(C); CALL FOUR(D) This is nice because it is a lot more readable, and subroutines are really subroutines, men are really men, and small furry creatures from alpha centauri ... oh, never mind!