Chapter 19 — Teaching Notes

One-line purpose. Turn the reading skill (Ch. 17) and the process (Ch. 18) into a fast, reliable lookup: given any FORTRAN 77 construct, the student produces its faithful modern equivalent — and knows how to check that the numbers survived.

Key ideas to emphasize

  • It is a dictionary, and dictionaries are used, not memorized. Set the expectation that students will keep §19.5 (or Appendix E) open on the desk. The skill is looking it up and applying it correctly, not reciting fifteen mappings. Grade for correct, checked translations, not for recall.
  • Every "obsolescent/removed" form is one the compiler could not check. This is the through-line (the 🚪 Threshold). COMMON (two routines can disagree), GOTO (fall through to the wrong label), a(*) (wrong extent), implicit typing (a typo becomes a variable). The modern replacement is the same computation with the checking turned back on. If students internalize this one idea, the whole table becomes derivable.
  • Diagnose before you translate. The two entries where the right answer depends on why, not what: EQUIVALENCE (three jobs, three replacements) and GOTO (loop / early exit / next-iteration / error). Drill the diagnosis, because a mechanical translation of either is how modernizations break.
  • The one correctness fix vs. the style fixes. implicit none catches typos → correctness. Fixed→free-form and .LT.< are style. Students conflate these constantly; separate them explicitly.
  • A translation is defined by the numbers surviving it. Tie every translation back to the numerical-equivalence check (Ch. 18). The 4×4 PLATE interior — 37.5 next to the hot edge, 12.5 next to the cold (Ch. 18's hand-verified reference) — is the concrete, hand-checkable proof and the reason to prefer a translation you can verify over a rewrite you cannot.

Misconceptions to preempt

  • "Fixed-form was removed, so old .f files won't compile." (No — fixed-form is still legal; only some features like statement functions and PAUSE are removed. Compile old code with -std=legacy.)
  • "implicit none is just style." (No — it is the one correctness fix in §19.4; it catches the typo bug.)
  • "Adding intent is mechanical." (No — you must infer the real data flow; intent(out) vs inout on an array that only edges get written is the classic trap — it must be inout to preserve the interior.)
  • "Translate EQUIVALENCE to transfer." (Only for the bit-reinterpret use. Memory-saving → separate allocatable; fields-of-storage → derived type.)
  • "A declaration initializer resets the variable each call." (No — implicit SAVE; initialized once.)
  • ".EQ. becomes =." (No — ==. = is assignment.)

A live demonstration (5–8 minutes)

  1. Open code/plate-legacy.f and code/project-checkpoint.f90 side by side. Walk the parts list from CS-01's Phase 1: point at each legacy construct and its modern twin. Students see the dictionary applied to a whole program, not a fragment.
  2. Show the infinite-loop bug (🐛 in §19.2 / Exercise 19.12): take the modern relaxation loop, delete the .or. iter >= max_iter clause, and reason aloud about a non-converging input. Then restore it. This is the single most important "translate every clause" lesson.
  3. (Optional, Compiler Explorer) Paste a GO TO loop and its do/exit translation; note the generated code is no worse — often better — dispelling "structured code is slower."

Class-time budget (~50 min)

  • 6 min: framing — read (17) + process (18) + dictionary (19); how to use a reference chapter.
  • 12 min: §19.1 storage — COMMON→module (the highest-value move), EQUIVALENCE's three jobs, DATA→ initializer + the implicit-SAVE trap, static→allocatable.
  • 12 min: §19.2 control — the PLATE GOTO loop → do/exit; computed GOTOselect case; arithmetic IF and the real-zero trap; the dropped-clause infinite loop.
  • 8 min: §19.3 procedures — statement function → pure internal fn (removed from the standard!); assumed-size → assumed-shape; adding intent and inferring data flow.
  • 6 min: §19.4 form/typing — fixed→free (style) vs implicit typing→implicit none (correctness).
  • 6 min: Project Checkpoint — the finished modern PLATE; reproducing Ch. 18's 37.5/12.5 reference exactly as the equivalence proof.

Prerequisites to review

Chapter 17 (the legacy constructs — students must recognize them before they can translate them) and Chapter 8 (modules — the destination of the highest-value translation). A quick refresher on assumed-shape vs assumed-size (Ch. 6) pays off in §19.3.

Connections

Back: Ch. 17 (definitions), Ch. 18 (process + regression/equivalence), Ch. 4 (control constructs), Ch. 5 (arrays/allocatable), Ch. 6 (intent/assumed-shape/pure), Ch. 8 (modules), Ch. 9 (derived types). Forward: Ch. 20 (precision — Exercise 19.27; the real(dp) literal trap), Ch. 24 (the real stencil drops into the modernized PLATE), Ch. 33 (OpenMP on the update loop — CS-02, Exercise 19.23). This chapter closes Part IV.