From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA11884; Sat, 14 Apr 2001 12:41:05 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 MAA11853 for ; Sat, 14 Apr 2001 12:41:04 +0200 (MET DST) Received: from tor.abc.se (ns.abc.se [195.17.72.11]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f3EAf2D01938 for ; Sat, 14 Apr 2001 12:41:03 +0200 (MET DST) Received: from gateway (dialup-53 [195.17.73.53]) by tor.abc.se (8.9.3+Sun/8.9.3) with SMTP id MAA20662 for ; Sat, 14 Apr 2001 12:41:02 +0200 (MET DST) From: "Mattias Waldau" To: Subject: [Caml-list] Just wasted half-an-hour on returned curried functions Date: Sat, 14 Apr 2001 12:40:52 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I removed the last int-argument of a function, but only changed at the calls and in the body, however not in the arguments, thus I had an unused arg called ~(idx:int), i.e. let bar a ~(idx:int) = { var = a ; .... } I created data using this function and these (now curried) arguments were put into an array, and there is where I got the type error. It took me 30 minutes to find the true source. I could have found the error if I would have typed the result of the above mentioned function either at the return value or in the let, i.e. writing let bar a ~(idx:int) :annotated_var = { var = a ; .... } or let x:annotated_var = ..... in However, the compiler could have found the error for immediately by either 1. Told me that ~(idx:int) is an unused argument 2. or, had a special syntax ( for example '=()' ) for curried values, for example, and by that immediately complain in the let above. I know that alternative 2 is an absurd suggestion in the church of FPLs :-) but I don't like wasting time. Could someone give me some example code (except lablgtk, which is a nice but very hard to understand program) where the majority of the returned values are functions. /mattias P.s. I don't understand how to get warning using ocamlc, for example in the below code I both override methods and hide instance variables, but get no warnings. let foo () = let x = 0 in let x = 1 in x let foo () = let x = 0 in let x = 1 in x ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr