From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 5E8CEBC0A for ; Wed, 23 May 2007 15:37:11 +0200 (CEST) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4NDbAiU026675 for ; Wed, 23 May 2007 15:37:11 +0200 Received: from [84.59.106.217] (helo=gate.lan.gerd-stolpmann.de) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis), id 0ML2xA-1Hqr1I1QvT-0000oF; Wed, 23 May 2007 15:36:55 +0200 Received: from flakew.lan.gerd-stolpmann.de (fw.lan.gerd-stolpmann.de [192.168.1.1]) by gate.lan.gerd-stolpmann.de (Postfix) with ESMTP id 08E65C085; Wed, 23 May 2007 15:36:52 +0200 (CEST) Subject: Re: [Caml-list] Teaching bottomline, part 3: what should improve. From: Gerd Stolpmann To: Brian Hurt Cc: Vincent Hanquez , OCaml In-Reply-To: <46543875.9010305@janestcapital.com> References: <1179871823.6966.78.camel@Blefuscu> <1179875804.17533.33.camel@rosella.wigram> <20070523091909.GA8019@snarc.org> <46543875.9010305@janestcapital.com> Content-Type: text/plain Date: Wed, 23 May 2007 15:36:51 +0200 Message-Id: <1179927411.24233.5.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX18N3LwaQPM/Y+FCwa5W6ZfJ627RXoNITT0Raei AvCMEHsMAjRHxA1s63w9rtiHGIlok8kkZwm66PhGpmr/ZjLSLe FbDOSXd6G7ec/0aAO+sW2Tz4z+Vo7VE X-Miltered: at discorde with ID 46544386.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; gerd:01 stolpmann:01 ocaml:01 ocaml:01 inference:01 inference:01 cheers:01 compiler:01 mismatch:01 mli:01 gerd:01 stolpmann:01 viktoriastr:01 64293:01 darmstadt:01 Am Mittwoch, den 23.05.2007, 08:49 -0400 schrieb Brian Hurt: > Vincent Hanquez wrote: > > On Wed, May 23, 2007 at 09:16:44AM +1000, skaller wrote: > > > > > On Tue, 2007-05-22 at 18:10 -0400, David Teller wrote: > > > > > > > > > > * Error messages of the type system are somewhat obscure. The reflex of > > > > many students is "OCaml wants it to be of type XXX", rather than "there > > > > is a contradiction in what I wrote". It would be nice if there was a way > > > > to ask OCaml to display additional information on type errors. > > > > > > > This is a long standing peeve of mine. Lets face it: Ocaml just lies. > > > If it has inferred a type, then finds a contradiction, it should > > > report both the location of the contradication AND all of the source > > > lines that contributed to the inference. > > > > > > > I agree, this is one of the worst thing about ocaml type inference, > > and you sometimes end up to have to put explicit type to functions to > > find the offending lines (usually hundreds lines before the actual line > > that's printed), defeating the whole thing... > > > > Cheers, > > > > Hundreds of lines? I've seen ten's of lines, but never hundreds. I can confirm that: hundreds. This happens especially for mismatching class types, because the compiler tries to break the mismatch down. But beginners shouldn't use classes. > Of course, I generally type annotate at the level of functions at > least (using .mli files is to be encouraged, IMO). So type errors > generally don't escape functions. And I keep functions reasonably > short- tens of lines long at most... There is certainly a point. The length of type errors depends on your programming style. A teacher can give hints how to make everything easier to handle. (Although it is also a valid point in education to let the students find their limits.) Gerd -- ------------------------------------------------------------ Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany gerd@gerd-stolpmann.de http://www.gerd-stolpmann.de Phone: +49-6151-153855 Fax: +49-6151-997714 ------------------------------------------------------------