[plt-scheme] The problem with Scala (OT, sorry)

From: Keiko Nakata (keiko at kurims.kyoto-u.ac.jp)
Date: Fri Mar 5 10:31:43 EST 2010


> it is my rough anecdotal hear-say understanding that this happens in
> other languages that have type inference. iiuc, the wisdom for
> programming in ocaml is to actually put in type annotations anyway so
> that errors show up closer to the real human error, rather than miles
> away due to a type checker that manged to keep on trucking.

To the best of my knowledge, the situations of Ocaml and Scala are
different at least theoretically. Well, you may argue that the
differences do not really matter to the programmer.

The ways type inference works in Ocaml and Scala are different.
If I remember correctly, Scala uses local type inference, but Ocaml does not.
Scala adopts a nominal type system, whereas OCaml does a structural type system
for objects. Type inference is more tricky to support in nominal type systems.

As far as I understand, in the Ocaml community it has been one of the goals
to keep typability independent of, or at least less affected by, annotations. 

I agree that it is difficult to come up with appropriate 
criteria to judge how much type inference is independent of type 
E.g, D. Remy's MLF has a rather simple criterion on when annotations is
required. But I cannot formalize what "simple" means here. 

It is definitely an interesting problem, which I believe is worth studying :)


Posted on the users mailing list.