fortranfortran90fortran95

Should namelists be avoided in Fortran and if so what is the recommended alternative?


I often use the namelist feature for flexible input of parameter lists to FORTRAN programmes, but the other day when searching to remind myself of their use I came across this statement:

It (namelist language extension to f77) has now been included in the Fortran 90 language. However, NAMELIST is a poorly designed feature and should be avoided whenever possible.

I was just wondering

  1. if this is a generally held view?
  2. if yes, why is this the case?
  3. what the suggested alternative is for parameter input? (I of course use netcdf for gridded data file input, I'm thinking of run-time parameter settings here).

Solution

  • There is no mention of namelist inefficiency and poor design whatsoever in the canonical book of Metcalf et al.: Modern Fortran Explained. https://books.google.com/books?id=V7UVDAAAQBAJ&lpg=PP1&pg=PA197#v=onepage&q=namelist%20I/O&f=false To the contrary, I believe namelists -- especially with the added enhancements in Fortran 2003 and 2008 -- are quite useful and flexible method of data I/O.