Does the INTERFACE statement in Fortran make it a programming language officially implementing multiple dispatch? (I ask because the Wikipedia article linked does not feature Fortran among its seemingly comprehensive listing of example programming languages supporting the paradigm in question).
Is Fortran a multiple dispatch programming language?
226 views Asked by wanderinganon At
1
Interface blocks (introduced by the
interfacekeyword) are often used for generic interfaces. They work like C++ generics, no dynamic dispatch. You must distinguish static dispatch and dynamic dispatch. Both Fortran and C++ only have single dynamic dispatch by polymorphism using classes and inheritance/overloading.But interface blocks themselves have several independent kinds of usage in Fortran and only some deal with some kind of overloading. Often they just work like a function declaration in a C++ header.
Take the example from https://www.geeksforgeeks.org/function-overloading-c/ :
In Fortran you can do the same but instead declaring both subroutines with the same name straight away, you define two specific subroutines with a different name and make a generic interface for them
This is the good old static dispatch.