home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / edu / 1391 < prev    next >
Encoding:
Internet Message Format  |  1992-08-29  |  1.9 KB

  1. Xref: sparky comp.edu:1391 comp.lang.fortran:3261
  2. Path: sparky!uunet!cis.ohio-state.edu!ucbvax!dog.ee.lbl.gov!hellgate.utah.edu!lanl!cochiti.lanl.gov!jlg
  3. From: jlg@cochiti.lanl.gov (Jim Giles)
  4. Newsgroups: comp.edu,comp.lang.fortran
  5. Subject: Re: Small Language Wanted
  6. Keywords: modular programming
  7. Message-ID: <1992Aug28.161000.6930@newshost.lanl.gov>
  8. Date: 28 Aug 92 16:10:00 GMT
  9. References: <1992Aug25.095623.18808@news.Hawaii.Edu> <8749@amsaa-cleo.brl.mil>
  10. Sender: news@newshost.lanl.gov
  11. Distribution: na
  12. Organization: Los Alamos National Laboratory
  13. Lines: 33
  14.  
  15.  
  16. In article <8749@amsaa-cleo.brl.mil>, mcohen@amsaa-cleo.brl.mil (Marty Cohen) writes:
  17. |> [...]
  18. |> >And if the elimination of computed GO TOs will
  19. |> >help make FORTRAN more structured, then you can simply not use them.
  20. |> In Fortran 77 there is no way to code a while loop without using a GOTO.
  21.  
  22. In *NO* language is it possible to write a WHILE loop without a GOTO.
  23. In most languages, this GOTO is *spelled* END WHILE (or in some similar
  24. way).  To be sure, this is a much better spelling*(footnote).  But 
  25. semantically, a WHILE loop *IS* the following:
  26.  
  27.    10 IF (cond) THEN              !WHILE
  28.          ... body of loop ...
  29.       GOTO 10
  30.       ENDIF                       !END WHILE
  31.  
  32. Proper commentary will elucidate this further, and you should never
  33. use the label as the target of any *other* GOTO.  
  34.  
  35. This whole debate about GOTOs is irrelevant to the question of whether 
  36. Fortran programs (or those in any other language) are structured or not.
  37.  
  38. *(footnote): As I have stated before, it is my opinion that syntax
  39. is probably the *most* important aspect of a language's design.  And
  40. the lack of a WHILE loop is a very serious weakness to standard Fortran 77
  41. (which is why most implementations - on mainframes anyway - already allow
  42. DO WHILE --- ENDDO as an extension).  In spite of this weakness, Fortran
  43. has syntactic *advantages* over other languages for scientific/numerical
  44. work which offset it.
  45.  
  46. -- 
  47. J. Giles
  48.