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) andGOTO(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 nonecatches 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
PLATEinterior — 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
.ffiles won't compile." (No — fixed-form is still legal; only some features like statement functions andPAUSEare removed. Compile old code with-std=legacy.) - "
implicit noneis just style." (No — it is the one correctness fix in §19.4; it catches the typo bug.) - "Adding
intentis mechanical." (No — you must infer the real data flow;intent(out)vsinouton an array that only edges get written is the classic trap — it must beinoutto preserve the interior.) - "Translate
EQUIVALENCEtotransfer." (Only for the bit-reinterpret use. Memory-saving → separateallocatable; 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)
- Open
code/plate-legacy.fandcode/project-checkpoint.f90side 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. - Show the infinite-loop bug (🐛 in §19.2 / Exercise 19.12): take the modern relaxation loop, delete the
.or. iter >= max_iterclause, and reason aloud about a non-converging input. Then restore it. This is the single most important "translate every clause" lesson. - (Optional, Compiler Explorer) Paste a
GO TOloop and itsdo/exittranslation; 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-SAVEtrap, static→allocatable. - 12 min: §19.2 control — the
PLATEGOTOloop →do/exit; computedGOTO→select case; arithmeticIFand the real-zero trap; the dropped-clause infinite loop. - 8 min: §19.3 procedures — statement function →
pureinternal fn (removed from the standard!); assumed-size → assumed-shape; addingintentand 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.