Besides type extension, the methods available for injecting behavior are:
- Procedure arguments (as in SLATEC SLAP, e.g.
dcg.f
) - Procedure pointers (packed in a derived type for tidyness)
- Reverse communication (just like ARPACK, the venerable templates, or oneMKL RCI ISS)
By means of internal procedures, it’s always possible to convert an interface using one approach into a different one. Internal procedures have some weakness (indirection, executable stack) as explained here: Is creating nested subroutines/functions considered good practice in Fortran? - #25 by szakharin. For realistic problems I’d expect the linear operator apply
method to dominate the runtime.