Stdlib vs iso_fortran_env

I notice that the stdlib provides some of the functionality I previously used from iso_fortran_env such as the parameters from stdlib_kinds. Would it not make sense then to expose other parameters such as input_unit and output_unit through stdlib_io and error_unit through stdlib_error? Why use both iso_fortran_env and stdlib if one would suffice? I guess I envisioned the stdlib as a “replacement/substitute” for iso_fortran_env.

Just my $0.02

As I understand it, the primary purpose of stdlib_kinds is to provide kind constants for internal use by stdlib. If their definition should change to selected_real_kind or some other means, the definition only needs to be changed in one place (stdlib_kinds module) to be in effect for the whole library. stdlib_kinds are also provided to the user to ensure that the kinds are compatible with the specific procedures that stdlib provides.

I don’t think stdlib is or should be a replacement for iso_fortran_env, which is quite limited in scope. It also should not provide functionality that’s already provided by compilers. One of stdlib’s original motivations was to prototype functionality that may be a good candidates to be included in the standard, and to provide features that are set to appear in the upcoming standard but have not been implemented by compilers yet.

When a feature that originally appeared in stdlib is standardized and implemented by compilers, it should be retired from stdlib.

2 Likes