namelist is a useful fortran construct to quickly initialize variables from a file. A namelist has a name and contains a set of variables with a known type. This makes it similar to the type construct.
It happens often that the parameters given to a program or subroutine are best organized not as lists, but rather as hierarchical structures, like the menu interface. Extended type like type, extends(simple) :: advanced seems to be a good representation of this hierarchical structure.
However, reading this data representation with the namelist construct seems to be awkward because one might end up with very long namelists of the kind
&options
very_long_option_X = 1,
very_long_option_Y = 2,
long_option_B%long_descriptive_name_a = 10,
long_option_B%long_descriptive_name_b = 20,
long_option_D%long_suboption_DD%long_descriptive_name_a = 300,
long_option_D%long_suboption_DD%long_descriptive_name_b = 400,
long_option_D%long_suboption_DD%long_descriptive_name_c = 500,
/
Many people would say it is not ideal and they would rather prefer
&options
very_long_option_X = 1,
very_long_option_Y = 2,
&long_option_B
long_descriptive_name_a = 10,
long_descriptive_name_b = 20
/
&long_option_D
&long_suboption_DD
long_descriptive_name_a = 300,
long_descriptive_name_b = 400,
long_descriptive_name_c = 500
/
/
/
Therefore, I would like to ask what is a good approach to read such data structures. How do you deal with this kind of situations?