Fortran-202X-Proposals
Fortran-202X-Proposals copied to clipboard
Proposal: More flexible SELECT TYPE
Something so we can avoid these annoying nested select type
blocks.
So if you want to check if several variables are integers:
! if several variables are integers
select type (a,b,c) ! new syntax
class is (integer)
d = a + b + c
end select
Or if you want to check if a variable is any integer kind:
select type (a)
class is (integer(kind=*)) ! new syntax
d = a * 2
end select
Or any numeric kind:
select type (a)
class is (integer(kind=*), real(kind=*)) ! new syntax
d = 1 * 2
end select
And all together:
select type (a,b,c) ! new syntax
class is (integer(kind=*), real(kind=*)) ! new syntax
! a, b, and c are all either integers or reals,
! so compiler knows what to do here:
d = a + b + c
end select