Proposal: There should be a way to adapt code to the standards revision used by the compiler, and request a specific revision.
One possibility is to expose language revisions in the form of intrinsic modules. For example:
use, intrinsic :: ISO_FORTRAN_2008
This would also allow new functions to easily be renamed to avoid conflicts with existing code.
Another possibility is to follow the design of the new
FORTRAN_VERSION() – return the Fortran revision, as an integer, or maybe a string? Or, maybe multiple forms like
For conditional compilation, there should be standard tokens that define the language revision, similar to the ISO-C declaration
__STDC_VERSION__. Currently, preprocessing is not a standardized feature in Fortran compilers. coco is the official Fortran preprocessor, but it is far more common to use fpp. The
coco standards could be updated to define standard preprocessor tokens, and compilers supporting
fpp or any other preprocessor could define the same token=value pairs by convention.