Fortran package naming conventions

Looking at the Fortran packages list I see that some FPM package names have dashes - or underscores _ and that others use CamelCase. When/if a package registry is created, there need to be unique names for packages, and it would be confusing to have separate packages named NavierStokes, Navier-Stokes, and Navier_Stokes. The FPM naming conventions say the following are all valid:

   my_package     ! 1 underscore allowed
   My_Package     ! same as the former
   mypackage123   ! Numbers OK
   my-package     ! Will be read by fpm as "my_package"

Could the community could decide and communicate what naming convention is preferred for packages going forward, especially for a registry? At least a preference for hyphens or dashes should be expressed.

What R does for package names is to allow periods but not allow hyphens or underscores in package names and to allow flexible capitalization.

3 Likes

I have a preference for all lower case separated by underscores, probably because I am using to C++ standard library headers <unordered_map> etc. but yeah, I agree that there should be a standard naming convention. Although those are headers, not packages :I difficult question.

1 Like

You can find the relevant discussion here and here

The module naming conventions were designed to ensure that all packages in the fpm registry would never collide, so that whatever dependencies a package has, no two modules with the same name can ever appear (Fortran does not have namespaces).

Note this is not a style suggestion, but rather a build safety suggestion :blush:

2 Likes

Let’s standardize the package naming convention though.

From these options:

Here is an example of package names:

I can see that people use test-drive, M_CLI2, toml-f, fortran-regex to name a few.

It seems the my-package has slight preference. The M_CLI2 could be just m-cli2, that would still work I think.

https://github.com/topics/fortran-package-manager
and the fpm repository gives an extensive set of samples. Note that the “fpm new” command restricts a name to the same rules as a free-format Fortran variable name except it allows for - and converts it to _ for the package source files. Older packages migrated from netlib would tend to be only alphanumeric characters partly for historical reasons (many systems only allowed for eight-character case-insensitive or uppercase file names, which probably influenced the namings). Originally fpm did not allow - for the package name, but the rules were loosened partly because a number of packages people were adding fpm support for that pre-existed had - in the names. To allow for additional modules fpm already requires support for multiple underscores in submodules, as in the package being called M_name but other modules all having to then be of the form M_name__subname if strict naming conventions are enabled.

The rules are really not defined in the manifest file description, but in the rules for creating a registry package.

2 Likes