From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA21003 for caml-red; Thu, 14 Dec 2000 19:18:11 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA01137 for ; Wed, 13 Dec 2000 01:52:27 +0100 (MET) Received: from localhost.localdomain (kenny61.zip.com.au [61.8.18.189]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eBD0qN514943 for ; Wed, 13 Dec 2000 01:52:24 +0100 (MET) Received: from ozemail.com.au (IDENT:root@localhost [127.0.0.1]) by localhost.localdomain (8.9.3/8.8.7) with ESMTP id LAA24246; Wed, 13 Dec 2000 11:51:33 +1100 Message-ID: <3A36C815.EBA9AE89@ozemail.com.au> Date: Wed, 13 Dec 2000 11:51:33 +1100 From: John Max Skaller X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12-20 i686) X-Accept-Language: en MIME-Version: 1.0 To: Mattias Waldau CC: Caml-List Subject: Re: Functions must be explicitly typed, (was Same label in different types, how do people solve this?) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis@pauillac.inria.fr Mattias Waldau wrote: > > > In Felix, I compromised: functions must be explicitly typed > > when declared, but values don't: > > > > function f(a:int): int { val b = a; return b; } > > Which I think is an good idea. I normally type the functions in Ocaml, but I > don't type the local variables. But everything is a compromise. I do this regularly: let rec f (a:ta) (b:tb) (c:tc) (d:td) (e:te) = let ff e = f a b c d e in .... ff expr It would be a pain to have to type 'ff' here: it's more like a 'local variable' than a new function definition. In Ocaml, terse expression with the _option_ of adding a type constraint isn't that unreasonable. The real problem is that the inference engine isn't smart enough to remember _how_ it deduced a type, and report _both_ locations when there is a conflict. I have a suspicion this is non-trivial: probably worth a PhD. :-) -- John (Max) Skaller, mailto:skaller@maxtal.com.au 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net