Difference between pure module function and regular pure function

Hello,

I’ve seen pure module function in Fiat eg. and stdlib eg..

When and why do you use pure module function? What is the difference between it and pure function?

I’m relatively new to using Modern Fortran and have done a quick google and couldn’t find a reference. Apologies if I missed something obvious.

P.S.
A huge thank you to everyone working on Lfortran, stdLib, fpm, the VS Code fortran extension, modern fortran textbooks, and all the other great projects. They’ve helped me out a lot.

The key is the module attribute. This is used when you split your implementation between a module where you should declare the signature of your procedures as interfaces, and a submodule where you write the actual implementation.

You can check out the example in the fortran-lang website for reference Modules and Programs — Fortran Programming Language

1 Like

Great, thank you!

1 Like