Automatic typing
ponce
contact at gam3sfrommars.fr
Fri Jun 28 06:44:18 PDT 2013
On Friday, 28 June 2013 at 00:34:54 UTC, JS wrote:
> Would it be possible for a language(specifically d) to have the
> ability to automatically type a variable by looking at its use
> cases without adding too much complexity?
Well ocaml has it
(https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner) and well
it's not all that positive, at least in that language.
Combined with parametric polymorphism it's nice and sound, except
it has the potential to hide a simple typo a lot further from
where it is (think mixing up integer operators and FP operators).
As it break overloading on "leaves", it is the reason ocaml has
"print_string" and "print_int" which is quite frankly ugly.
Once you have type inference, the first thing you do to make your
code readable is to add back type annotations.
More information about the Digitalmars-d
mailing list