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 TAA24918 for caml-red; Thu, 14 Dec 2000 19:31:12 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA32089 for ; Thu, 14 Dec 2000 15:12:53 +0100 (MET) Received: from cs.huji.ac.il (cs.huji.ac.il [132.65.16.10]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eBEECqL12426 for ; Thu, 14 Dec 2000 15:12:52 +0100 (MET) Received: from zigzag.cs.huji.ac.il ([132.65.208.204]) by cs.huji.ac.il with esmtp (Exim 3.20 #1) id 146Z7o-0003z1-00 for caml-list@inria.fr; Thu, 14 Dec 2000 16:12:48 +0200 Received: (from orodeh@localhost) by zigzag.cs.huji.ac.il (8.9.3/1.1c) id QAA12648; Thu, 14 Dec 2000 16:12:48 +0200 Date: Thu, 14 Dec 2000 16:12:48 +0200 (IST) From: Ohad Rodeh To: Caml List Subject: Type annotations Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis@pauillac.inria.fr Dear List, I've previously sent a message, for which I got no replies, so I'm resending it. > ... stuff removed ... > > > Also, I am a bit curious why it doesn't help to type explicitely, > > i.e. to > > write > > let x:point_3d={x=10.;y=20.;z=30.} ??? > > > > Because this is not the way it works. Labels are defined as are values > or constructors, this is only afterwards that the compiler checks that > they all belong to the same type. That is, the type cannot influence the > choice between x(point_3d) and x(point_2d), only the order of > definition can. > > There has been already various proposals for allowing types to be taken > into account when typing record labels. The difficulty is that as soon > as you make it into something useful, you loose the principal type > property, and that some theoreticians working on ocaml wouldn't like > it. The loss of the pricipal type theorem has also recently been discussed in comp.lang.ml and comp.lang.functional. Using type-annotation by the compiler prior (call this the PRIOR approach) to unification can help typing expression that cannot be typed otherwise. For example, cases of polymoriphic recursion. In fact, this is the way this is handled in Haskell (this topic has also appeared in this list previously). Although I wouldn't go running to implement all my code in Haskell :-), I do think that using PRIOR could be an improvement. Is there a problem with PRIOR? Ohad.