Fortran 2018 & 2023 Features
Generic programming with templates, possibly exceptions-like features and more interop improvements.
36.1 Fortran 2018
Further C interoperability: ISO_Fortran_binding.h, assumed-rank (..) and select rank, assumed-type (type(*)).
Coarray enhancements: teams, events, collective subroutines (co_sum, co_broadcast, ...), failed images.
implicit none (type, external), error stop in pure procedures, random_init.
Locality specifiers in do concurrent (local, local_init, shared, default(none)).
Procedures recursive by default (unless non_recursive).
out_of_range(), reduce() intrinsic, IEEE improvements.
36.2 Fortran 2023
Conditional expressions: x = (a > b ? a : b); conditional arguments.
Enumeration types (enumeration type ... end enumeration type).
typeof / classof type specifiers.
reduce locality in do concurrent.
Degree trigonometric (sind, cosd, ...) and half-revolution functions (sinpi, acospi, ...).
selected_logical_kind, extended @ simple procedures, split and tokenize intrinsics for strings.
Longer source lines (10,000 characters) and statements.
Boz constants in more contexts, c_f_strpointer, f_c_string for C strings.
Allocatable deferred-length character iomsg/errmsg.
36.3 Fortran 202Y (next standard, in development)
Generic programming with templates, possibly exceptions-like features and more interop improvements.
36.4 Checking compiler support
Feature support differs across gfortran, ifx, flang, nvfortran, Cray, and NAG — consult each compiler's documentation and the fortran-lang compiler support tables before relying on newer features.
🧪 Part III Exercises
Build an abstract ode_solver type with deferred step, and euler/rk4 extensions; solve y' = −y and compare errors.
Implement a vector type with +, -, *, .dot., .cross., ==, and user-defined formatted I/O.
Write a generic stack container using class(*) that can hold integers, reals, and strings.
Split a module into a module (interfaces) + submodule (implementation); show that changing the implementation doesn't rebuild dependents.
Call a C function that sorts an array (qsort with a Fortran comparison callback via c_funloc).
Wrap a Fortran routine (e.g., a 1-D heat equation solver) with f2py and call it from Python/NumPy.
Parallelize a 2-D Jacobi solver with OpenMP; measure speedup for 1–N threads.
Implement the same Jacobi solver with MPI domain decomposition and halo exchange.
Port the Jacobi kernel to do concurrent and to OpenACC/OpenMP offload (if a GPU is available).
Solve a 1000×1000 linear system with LAPACK dgesv and compare runtime with a hand-written Gaussian elimination.