Affiliate disclosure
Book titles on this page link to Amazon. As an Amazon Associate, DataField.Dev earns from qualifying purchases — at no additional cost to you.
Further Reading: Object-Oriented Fortran
Object orientation is the part of Fortran where the reference books and the community documentation earn their keep, because the rules (passed-object dummies, deferred bindings, finalization) have corners. Sources are tagged Tier 1 (works we are confident exist and recommend) and Tier 2 (real and worth seeking, but confirm the current edition/URL yourself).
The definitive references
- Metcalf, Reid, and Cohen, Modern Fortran Explained (Oxford University Press). The authoritative
treatment of Fortran's object model — type extension, polymorphism,
select type, abstract types, and finalization — with the exact rules the standard specifies. When a subtlety of dispatch or finalization bites you, this is the book that resolves it. Tier 1. - Milan Curcic, Modern Fortran: Building Efficient Parallel Applications (Manning). Project-driven and modern; its treatment of derived types and object-oriented design is close in spirit to this chapter, and it is honest about when to reach for these features and when not to. Tier 1.
- Stephen Chapman, Fortran for Scientists and Engineers (McGraw-Hill). A gentler, example-led introduction to Fortran's OOP for readers who want more worked examples of inheritance and type-bound procedures before tackling the reference. Tier 1.
Free and online
fortran-lang.org— "Learn" and the mini-book. The community learning resources include clear, current pages on derived types and object-oriented programming, with runnable snippets. The best free starting point. Tier 1.- The GCC /
gfortrandocumentation. The "GNU Fortran" manual documents which Fortran 2003/2008 OOP features are supported and flags the corners of finalization support in particular — essential reading before you rely on afinalprocedure in production. Tier 1. - The Fortran Discourse (
fortran-lang.discourse.group). Search it for real threads onselect typedesign, polymorphic containers (the "array of boxes" idiom), and gfortran finalization behavior — the questions in this chapter are asked and answered there regularly. Tier 1.
Primary source
- ISO/IEC 1539-1:2018 (the Fortran 2018 standard). The final word on the object model: the exact
semantics of type extension, polymorphic assignment, the
select typematching rules, deferred bindings, and when finalization occurs. Dense, but definitive when a book and a compiler disagree. Tier 1. - The Fortran 2003 standard and its rationale documents. Object orientation entered the language in 2003;
the rationale explains why the committee chose this particular model (passed-object dummies,
class, abstract interfaces), which makes the design far easier to remember. Tier 2 (locate the specific document).
Tools
- Compiler Explorer (
godbolt.org), withgfortran. Paste a small polymorphic call and watch the compiler emit the indirect dispatch — then paste the monomorphic equivalent and watch it inline and vectorize. This is the single most convincing way to see the cost §10.5 describes, and a preview of Chapter 27. Tier 1.
Suggested order
- Read the
fortran-lang.orgOOP pages for a fast, current overview with runnable code. - Work this chapter's
code/examples, predicting every output before you compile. - Keep Metcalf, Reid & Cohen beside you for the exact rules — especially finalization and
select typematching — and reach for the 2018 standard only when the reference and your compiler disagree. - Before you ship a
finalprocedure, read the gfortran notes on finalization support for your version. - When you are ready to see the performance argument, open Godbolt and compare a dispatched call with a monomorphic one.