Here is something that I would like to have in Fortran also:
The example shows Julia code for using a Python library. And if the import is changed, the very same code is also a valid Python code. Thus showing that at this high user level, Julia is very similar to Python.
Looking at the example, it seems it might work in Fortran, if we replace .
with %
. I don’t know how to best simulate nested modules. I wish the following two proposals somehow could get accepted, because then I think the code would run in Fortran verbatim:
https://github.com/j3-fortran/fortran_proposals/issues/86
https://gitlab.com/lfortran/lfortran/-/issues/84
The last one I didn’t even post at the fortran_proposals
repository, as I think the chance is very low at this point. But the first one I think might have a chance.
The other related thought that I have is to have automatic translators from Python and also from C++ into Fortran. The way they would work from Python is that they would take the Python code, and then translate into Fortran, calling any libraries from Python, but the script itself would be in Fortran, with the correct syntax. So you would give it the above script, and it would spit out correct Fortran that you can run. The same with C++. I think that’s technically doable and would go a long way to help people move to Fortran from those languages.