3 ms·
The State of Fortran Generics
- pjmlp 4y agoInteresting development, as Fortran already has support for some kind of genericity. https://annefou.github.io/Fortran/modules/modules.html https://annefou.github.io/Fortran/modules/modules.html
- xioxox 4y agoI think the existing support more like "function overloading" in C++ - you make some subroutine/function name which calls the appropriate subroutine/function with the correct argument types. Unfortunately the existing support isn't like proper generics. In my Fortran code I use C macros (#include) to avoid repeating big blocks of generic code for each data type. For example, I needed to do this for a sort routine which could act on different data types. This is very clumsy, so any proper generics will be welcome. Hopefully there will be a STL-like library which could be based around these generics.
- tialaramex 4y ago> I think the existing support more like "function overloading" in C++ - you make some subroutine/function name which calls the appropriate subroutine/function with the correct argument types. I agree, this appears to support ad hoc polymorphism. You could carefully use this to deliver only the behaviour you'd want from parametric polymorphism in some cases, but the ergonomics are poorer.