Fortran is in a tough spot regarding preprocessing. It doesn’t have generic programming, so pre-processing is sometimes needed (particularly when writing libraries), but there’s no standardized preprocessor - so everyone just uses whatever they personally like the best.
There are many options out there in the wild with different strengths and weaknesses. I don’t think that fypp is bad, but I do wish that stdlib was completely self-contained. As it is, fypp and therefore Python are required in order to build it. In the interest of making stdlib self-contained, would there be any willingness to move away from fypp for stdlib, and towards a different pre-processor that is written in fortran and directly packaged in the stdlib repository? That way, the only thing needed to build it is a fortran compiler (which anybody using stdlib must have anyways).
I would strongly prefer making this change, and I don’t care what that hypothetical preprocessor is. While I’m sure there are others, I’m aware than @urbanjost has written one under a permissive license A streamlined preprocessor written in Fortran . I personally have no vested interest in using this one or another one, but I do think we are better off by making stdlib self-contained, requiring only a Fortran compiler.
Doing this would also give us the opportunity to solve another problem that stdlib must eventually fix. Since Fortran permits different processors to implement different kinds, the only way to offer a generic library that supports every data type that the underlying compiler supports is to query
integer_kinds, etc, and generate code accordingly. If we move to a preprocessor written in Fortran, we can fold the _kinds checks into the preprocessing step. For example, gfortran supports
real(kind=10) on x86 - it’s the x87 80 bit floating point implementation. But the intel compiler does not support it - if we want to support it in stdlib, then we need to generate extra routines for kind=10 at build time. A preprocessor written in Fortran could both figure this out AND generate the code.