Thank you for clarifying. In the case of my own workflow, this becomes far easier with the proposed syntax. With each variable declared on a separate line, grep namelist_groupname
returns a compact list of the variable declarations of all its members, to be viewed on-screen or redirected to a pipe or a file for further searching or analysis. As a bonus I can see all their types, kinds, dimensions, and other attributes at a glance.
$ grep snp # my namelist is called snp
# or a more precise search
$ grep 'namelist(snp)' # my namelist is called snp
my_module.f90: real, namelist(snp), public :: good
my_module.f90: real, namelist(snp), dimension(10), public :: push
my_module.f90: real, namelist(snp), public :: it
my_module.f90: integer, namelist(snp) :: countthem
In contrast, with the current namelist
syntax I have to open the file or have grep
print a large number of context lines to see the namelist
members.
$ grep snp # my namelist is called snp
my_module.f90: namelist / snp / good, countthem, push, it & ! only the first few members
In reverse, if I grep
for a variable name using my proposed syntax, I would immediately see its declaration including all its namelist
groups directly in the result (assuming it fits on one line):
$ grep good
my_module.f90: real, namelist(snp1, snp2, othernml) :: good
In contrast, with the current namelist / groupname / varnames ...
syntax, I would see its declaration but it’s unlikely the namelist
group name would appear in a search for a variable name since they are generally on separate lines. Most likely I would see a slice of the namelist
membership without the actual group name, such as
$ grep good
my_module.f90: real :: good
my_module.f90: good, countthem, push, it, & ! no sign of the namelist group name