In certain programming languages, most notably in C, there are header files with function declarations. These function "headers" come before the code, and are required for situations with mutual recursion. When the function headers are placed in a header file, they also help with linking situations where multiple C files are compiled together.
My understanding of function headers within a C file is that they help with compilation because they define the typing of the function if it is called before it is defined. If this is wrong, I would be happy to stand corrected and better informed, but this is my understanding of it.
So what I don't understand, is why other languages - in this case I'm singling out OCaml - don't have function headers. In OCaml, there modules with signatures, but a signature does not allow your instantiations of functions to be mutually recursive, even though the typings are given. In order to have mutual recursion in OCaml, you need to use either the "and" keyword, or defined one function locally within the other function (to the best of my knowledge).
(* version 1 *)
let rec firstfun = function
| 0 -> 1
| x -> secondfun (x - 1)
and secondfun = function
| 0 -> 1
| x -> firstfun x
(* version 2 *)
let rec firstfun = function
| 0 -> 1
| x ->
let rec secondfun = function
|0 -> 1
| x -> firstfun x in
secondfun (x - 1)
So why is this the case? Is it related to polymorphism? Is there a compilation bottleneck I'm not considering?