At 02:35 31/08/99 -0400, John Prevost wrote:
>In some ways, this isn't really a problem--one of the big pieces of
>utility in the ML family of languages is that type inference allows
>you to leave out such type signatures. And explicit signatures for
>modules takes care of the general case.
>
>So, it's sort of an obscure problem.
I find the 'utility' of type inference more limited.
For many functions, I want to declare the type, to make the
program more readable and reduce the scope of type errors.
(Since ocaml does 'inference first', then checks constraints,
this second technique I'm all too familiar with from using
languages using explicit typing, doesn't work so well).
In any case, for me at least, it is not an obsure problem,
and I thank you at for exhibiting alternate syntax forms that
will ease the burden of declaring families of functions.
The case arises naturally in providing an Ocaml/Python binding,
the python builtin functions and methods -- and there are lots of them --
are ocaml functions with a fixed type. It is therefore natural to
want to abbreviate the declarations: in the interface, the types
are trivially given by
val f : t
and now, in the body by
let (f:t) = fun a b c d e -> body
which saves annotating each argument, which is a pain because the
names of the parameter types are long, my previous style requiring a line each
parameter (instead of one line per function).
-------------------------------------------------------
John Skaller email: skaller@maxtal.com.au
http://www.maxtal.com.au/~skaller
phone: 61-2-96600850
snail: 10/1 Toxteth Rd, Glebe NSW 2037, Australia