home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Trees / V7 / usr / doc / ratfor / m4 < prev    next >
Encoding:
Text File  |  1979-01-10  |  3.7 KB  |  135 lines

  1. .NH
  2. EXPERIENCE
  3. .SH
  4. Good Things
  5. .PP
  6. ``It's
  7. so much better than Fortran''
  8. is the most common response of users
  9. when asked how well
  10. Ratfor
  11. meets their needs.
  12. Although cynics might consider this to be vacuous,
  13. it does seem to be true that 
  14. decent control flow and cosmetics converts Fortran
  15. from a bad language into quite a reasonable one,
  16. assuming that Fortran data structures are adequate
  17. for the task at hand.
  18. .PP
  19. Although there are no quantitative results,
  20. users feel that coding in
  21. Ratfor
  22. is at least twice as fast as in Fortran.
  23. More important, debugging and subsequent revision
  24. are much faster than in Fortran.
  25. Partly this is simply because the code can be
  26. .ul
  27. read.
  28. The looping statements
  29. which test at the top instead of the bottom
  30. seem to eliminate or at least
  31. reduce the occurrence of a wide class of
  32. boundary errors.
  33. And of course it is easy to do structured programming in 
  34. Ratfor;
  35. this self-discipline also contributes
  36. markedly to reliability.
  37. .PP
  38. One interesting and encouraging fact is that
  39. programs written in
  40. Ratfor
  41. tend to be as readable as programs
  42. written in more modern languages
  43. like Pascal.
  44. Once one is freed from the shackles of Fortran's
  45. clerical detail and rigid input format,
  46. it is easy to write code that is readable, even esthetically pleasing.
  47. For example,
  48. here is a
  49. Ratfor
  50. implementation of the linear table search discussed by
  51. Knuth [7]:
  52. .P1
  53. A(m+1) = x
  54. for (i = 1; A(i) != x; i = i + 1)
  55.     ;
  56. if (i > m) {
  57.     m = i
  58.     B(i) = 1
  59. }
  60. else
  61.     B(i) = B(i) + 1
  62. .P2
  63. A large corpus (5400 lines) of Ratfor, including a subset of
  64. the Ratfor preprocessor itself,
  65. can be found in
  66. [8].
  67. .SH
  68. Bad Things
  69. .PP
  70. The biggest single problem is that many Fortran syntax errors
  71. are not detected by
  72. Ratfor
  73. but by the local Fortran compiler.
  74. The compiler then prints a message
  75. in terms of the generated Fortran,
  76. and in a few cases this may be difficult
  77. to relate back to the offending
  78. Ratfor
  79. line,
  80. especially if the implementation conceals the generated Fortran.
  81. This problem could be dealt with
  82. by tagging each generated line with some indication
  83. of the source line that created it,
  84. but this is inherently implementation-dependent,
  85. so no action has yet been taken.
  86. Error message interpretation
  87. is actually not so arduous as might be thought.
  88. Since Ratfor generates no variables,
  89. only a simple pattern of
  90. .UC IF 's
  91. and
  92. .UC GOTO 's,
  93. data-related errors like missing
  94. .UC DIMENSION
  95. statements
  96. are easy to find in the Fortran.
  97. Furthermore, there has been a steady improvement
  98. in Ratfor's ability to catch trivial syntactic
  99. errors like unbalanced parentheses and quotes.
  100. .PP
  101. There are a number of implementation weaknesses
  102. that are a nuisance, especially to new users.
  103. For example,
  104. keywords are reserved.
  105. This rarely makes any difference, except for those hardy souls
  106. who want to use an Arithmetic 
  107. .UC IF .
  108. A few standard Fortran
  109. constructions are not accepted by 
  110. Ratfor,
  111. and this is perceived as a problem by users with a large corpus
  112. of existing Fortran programs.
  113. Protecting every line with a `%' is not really a
  114. complete solution, although it serves as a stop-gap.
  115. The best long-term solution is provided by the program
  116. Struct [9],
  117. which converts arbitrary Fortran programs into Ratfor.
  118. .PP
  119. Users who export programs often complain that the generated Fortran is
  120. ``unreadable'' because it is not 
  121. tastefully formatted and contains extraneous
  122. .UC CONTINUE
  123. statements.
  124. To some extent this can be ameliorated
  125. (Ratfor now has an option to copy Ratfor comments into
  126. the generated Fortran),
  127. but it has always seemed that effort is better spent
  128. on the input language than on the output esthetics.
  129. .PP
  130. One final problem is partly attributable to success _
  131. since Ratfor is relatively easy to modify,
  132. there are now several dialects of Ratfor.
  133. Fortunately, so far most of the differences are in character set,
  134. or in invisible aspects like code generation.
  135.