From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA13153 for caml-redistribution@pauillac.inria.fr; Fri, 11 Feb 2000 10:28:02 +0100 (MET) Resent-Message-Id: <200002110928.KAA13153@pauillac.inria.fr> 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 OAA06384 for ; Thu, 10 Feb 2000 14:49:26 +0100 (MET) Received: from indigo.recherche.enac.fr (indigo.recherche.enac.fr [195.220.158.66]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id OAA24023 for ; Thu, 10 Feb 2000 14:49:23 +0100 (MET) Received: from rouge.recherche.enac.fr (root@rouge.recherche.enac.fr [195.220.158.70]) by indigo.recherche.enac.fr (8.8.6 (PHNE_14041)/8.6.11) with ESMTP id OAA29050 for ; Thu, 10 Feb 2000 14:49:24 +0100 (MET) Received: from recherche.enac.fr (alliot@localhost [127.0.0.1]) by rouge.recherche.enac.fr (8.9.3/8.6.11) with ESMTP id OAA06229 for ; Thu, 10 Feb 2000 14:49:23 +0100 X-Authentication-Warning: rouge.recherche.enac.fr: Host alliot@localhost [127.0.0.1] claimed to be recherche.enac.fr Sender: alliot@recherche.enac.fr Message-ID: <38A2C1E3.1CF1AFFC@recherche.enac.fr> Date: Thu, 10 Feb 2000 14:49:23 +0100 From: jean-marc alliot Organization: Laboratoire d'Optimisation Globale X-Mailer: Mozilla 4.7 [en] (X11; I; Linux 2.2.12 i686) X-Accept-Language: fr-FR MIME-Version: 1.0 To: "caml-list@inria.fr" Subject: Typing problem Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Resent-From: weis@pauillac.inria.fr Resent-Date: Fri, 11 Feb 2000 10:28:02 +0100 Resent-To: caml-redistribution@pauillac.inria.fr We recently found a quite annoying problem with the typing system in ocaml 2.99, and Jacques Garrigue explained it to us very kindly. Other people might be be interested however. The problem is summarized in the following code: First let's define two types: type t1 = (?l:int -> unit -> unit) type t = Toto of t1 Then the function: let f1 g = g l:3 (); (Toto g);; This function doesn't compile and the compiler error message is somewhat cryptic at first sight: File "toto.ml", line 11, characters 8-9: This expression has type int -> unit -> 'a but is here used with type t1 = ?l:int -> unit -> unit To make it compile, you have to type explicitly g with: let f2 (g : t1) = g l:3 (); (Toto g);; We would very much like to see this clearly documented in ocaml 2.99 reference manual, as it is a serious change in the behavior of the typing system. Determinism is lost, as typing f1 would succeed if typing was done in reverse order (from last line to first line). Perhaps also a different error message from the compiler would help in detecting such problems. P Brisset JM Alliot