Some other use of `{}`

Personally, I’d be in favour of bringing some of the Python string formatting features to Fortran. C++ has also adopted them, if you look at the standard format specification used by the std::format (C++20) and std::println (C++23) functions.

In the past I’ve wondered how hard would it be to write an external tool which translated from Python/C/C++ format strings into a Fortran format specifier. The same tool could be used in a preprocessor, with a simple regex-based parser that detected f"..." strings, and replaced them with internal I/O. This would also help to etch out the design of this feature further.

4 Likes