English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Re: convincing management to switch to Ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-09-06 (16:18)
From: John Skaller <skaller@m...>
Subject: Re: convincing management to switch to Ocaml
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
		phone: 61-2-96600850
		snail: 10/1 Toxteth Rd, Glebe NSW 2037, Australia