As noted in this thread, this is in effect now a user library that indeed employs “allocatable characters” and so from some of the standard bearers’ point-of-view, it is just making use of the base language.
Note though the advantages with the derived type mentioned in the original post with the use case of “jagged” arrays of CHARACTER
type and their use with ELEMENTAL
subprograms do come at a cost because the practitioners are inclined to seek an equivalent of the intrinsic type whereas a user derived type, given the limitations of the Fortran standard, simply cannot do all that intrinsic types have been extended to provide over the years.
With the now deleted part of the ISO IEC standard, ISO_VARYING_STRING
has no official status to be extended. And as things stand, certain users will be disappointed it’s not the same as working with CHARACTER
type - some immediate examples:
character(len=:), allocatable :: s
s = "Hello World!"
print *, "s%len = ", s%len, "; s%kind = ", s%kind
print "(*(g0))", "s(1:3) = ", s(1:3)
end
versus
use iso_varying_string
type(varying_string) :: s
s = "Hello World!"
print *, "s%len = ", s%len, "; s%kind = ", s%kind !<-- won't work as defined now
print "(*(g0))", "s(1:3) = ", s(1:3) !<-- won't work
end
To me, all this shows an urgent need for a new intrinsic type of string
in the Fortran standard that serves the practitioners of Fortran with all the inherent benefits and which then obviates the need for all such user libraries. It is a relatively minor effort for the standard to be extended but, my gosh, it is the hardest thing to convince the vendors to lend support for this. The above trivial example with the substring referencing alone should suffice; alas that is not the case.
The situation with the lack of an intrinsic string
type is yet another data point that makes me wonder, For whom Fortran, for what?.