On evidence, one can concede the evolution of the Fortran language has erred more on the side of pragmatic progress rather than intransigence on the basis of an extreme ideological position on backward compatibility. And that is a good thing.
I would like to appeal to the same sentiment moving forward and once and for all gift the future generation of programmers of Fortran with an evolved and truly modern Fortran language feature that has implicit none
as the default in all program units and interface bodies.
Consider the following conformant code per current standard:
character(len=:), allocatable :: s
allocate( character(len=10) :: s )
write( s, fmt="(a)" ) "x"
print *, "len(s) = ", len(s)
end
and the program behavior according to a couple of compilers:
C:\temp>gfortran p.f90 -o p.exe
C:\temp>p.exe
len(s) = 10
C:\temp>ifort /standard-semantics p.f90
Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.6.0 Build 20220226_000000
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.
Microsoft (R) Incremental Linker Version 14.30.30706.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:p.exe
-subsystem:console
p.obj
C:\temp>p.exe
len(s) = 10
Now note starting Fortran 202X, the program behavior according to conforming compiler will change, the program output shall be len(s) = 1
.
This is a breaking change, I know at least one program in production use by the team I work with that will break as a result of Fortran 202X. The change comes into play with the use of deferred-length allocatable objects of character
type in certain instructions, internal IO being one of them but there are other situations also.
This was pointed out to the Fortran committee, but it made no difference to the decision making: the feeling was any programs that might break can go pound sand - they can fix themselves if they are to remain in Fortran, but they shall not stand in the way of the collective decision-making by the committee.
Let the same sentiment and line of thinking come to apply with implicit none
, let it be the default starting Fortran 202Y.
I think this is what the Fortran community should clamor and call for.
The community should realize the drop-by-drop waste of time and resources by being forced to include implicit none
in every module, program, interface body, etc. and say enough is enough.