On Sun, Jan 06, 2008 at 02:32:45PM -0800, Chuck Esterbrook wrote:

I don't think you do Hindley-Milner type-inference.  You infer types of
variables so that they don't have to be declared.  That's quite a bit less
than H-M, which does type inference of _everything_, with polymorphism and
lots of nifty stuff.

I agree. Cobra does not do Hindley-Milner type-inference. It's
type-inference is a shortcut for declarations, as you pointed out. Its
support for dynamic binding enables it to act like Python or Smalltalk
where variables and expressions do not have compile-time types.

I don't mean to be disparaging.  Declaration inference is immensely useful.
Having to declare types of every variable and argument is a lot of what
makes most static-type programming so tedious.

   LongArduousType foo = new LongArduousType(..);

I think distracts from readability.  It's much better to only declare the
type there when it is going to be different.

Hindley-Milner brings along it's own kind of type-algebra, which is fairly
different than OO.  Ocaml makes an attempt to combine them, even providing
duck typing with a statically-typed language.  I've personally found ocaml
programming to kind of overwhelm me with decision anxiety as to which model
I should be using, since they are so different.

Dave

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to