Ah very interesting. I guess my question was mainly about
and, though I hadn't thought about the reasons for
rec. It makes sense that that removes a class of errors.
So as a follow-up question: why is type inference impossible without and or what is it about and that makes it possible? For instance, what would happen if I (out of laziness or something) would just insert and everywhere, even for functions that aren't mutually recursive. So, e.g.
let rec f x = x + 1
and g y = y * 2
Would type inference somehow fail on that? If not, what's stopping me from writing a version of OCaml where all top level lets are automatically converted to
let ... and ... and? (Other than a complete lack of necessary compiler writing skills obviously)