What is type inference?
Historically, type inference (or type reconstruction) has meant that all types in a program can be inferred without requiring mainly annotations of an explicit type. However, in recent years, the main thesis in the programming language has become the designation of even the most trivial forms of type inference from bottom to top as "type inference" (for example, new auto declarations in C ++ 11). So people started adding βfullβ to refer to the βrealβ thing.
What is full type inference?
There is a wide range to what extent a language can output types, and in practice, almost no language supports the "full" type of output in the strict sense (basic ML is the only example). But the main distinguishing factor is whether types can be obtained for bindings that do not have a βdefinitionβ attached to them; in particular, function parameters. If you can write, say
f(x) = x + 1
and the type system determines that f eg is of type Int β Int, then it makes sense to call this type of output. Moreover, we are talking about the conclusion of the polymorphic type, when, for example,
g(x) = x
assigned the generic type & forall; (t) t β t automatically.
Type inference was invented in the context of simply typed lambda calculus, and polymorphic type inference (the so-called inference of the Hindley / Milner type, invented in the 1970s) is a claim to the glory of the ML language family (Standard ML, OCaml, and possibly Haskell )
What are the limits of full type inference?
Core ML has the luxury of a "complete" polymorphic type output. But it depends on certain limitations of polymorphism in its type system. In particular, only definitions can be general, not function arguments. I.e
id(x) = x; id(5); id(True)
works just fine because id can be given by a polymorphic type when the definition is known. But
f(id) = (id(5); id(True))
does not set validation in ML, because id cannot be polymorphic as an argument to a function. In other words, the type system allows polymorphic types, such as & forall; (t) t β t, but not the so-called polymorphic types of a higher rank, such as (? forall; (t) t β t) β Bool, where the polymorphic values ββare used in a first-class manner (which, to be understood, allows even very few explicitly typed languages).
The polymorphic lambda calculus (also called "System F"), which is explicitly introduced, allows the latter to be used. But the standard result of type theory is that type reconstruction for the complete system F is unsolvable. Hindley / Milner falls into the sweet spot of a slightly less expressive type system for which type reconstruction is still solvable.
There are more advanced type system functions that also make complete type reconstruction impossible. And there are others who keep it solvable, but still make it impracticable, for example. the presence of ad-hoc overload or subtyping, as this leads to a combinatorial explosion.