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.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id C1BACBC6B for ; Sun, 19 Aug 2007 19:07:29 +0200 (CEST) Received: from furbychan.cocan.org (furbychan.cocan.org [80.68.91.176]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7JH7SGF012967 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Sun, 19 Aug 2007 19:07:29 +0200 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1IMoFA-0003a6-00; Sun, 19 Aug 2007 18:07:16 +0100 Date: Sun, 19 Aug 2007 18:07:16 +0100 To: John Carr Cc: Caml-list List Subject: Re: [Caml-list] If OCaml were a car Message-ID: <20070819170704.GA10089@furbychan.cocan.org> References: <56864F61-40F3-4F03-9823-6D510AD5320B@epfl.ch> <200708191443.l7JEhEQ8007374@psi-phi.mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200708191443.l7JEhEQ8007374@psi-phi.mit.edu> User-Agent: Mutt/1.5.9i From: Richard Jones X-Miltered: at discorde with ID 46C878D0.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 syntax:01 parser:01 syntax:01 foo:01 gcc:01 compiler:01 compiler:01 ocamlopt:01 semicolons:01 toplevel:01 wiki:01 921:98 beginners:01 On Sun, Aug 19, 2007 at 10:43:14AM -0400, John Carr wrote: > > Maybe I ride this car too often to realize (or I'm dumb) but I don't > > get the joke about controls. > > OCaml has a badly designed syntax processed by a badly implemented > parser feeding into a backend that generates poor error messages. > All this makes the language hard to use. I think this is a little bit of an exaggeration, but there is some truth to it. It's not likely that the syntax can be changed (how is the revised syntax doing lately?) but there is one error message which could be fixed. When I worked at Merjis a colleague got frustrated to the point of virtually giving up the language at the error message "Foo makes inconsistent assumptions over Bar"[1]. It is literally useless: it does not describe what it means, what files are involved which are inconsistent, what their MD5 sums are or should be, and lastly it doesn't say how to fix the problem (which generally involves recompiling libraries). On the up side, OCaml does show you the range of characters within the line where the error happens. This is something I now really miss when using gcc / C code. > Anybody else learn C using pcc on Unix? Using the traditional K&R compiler for OS-9/68k and later using pcc on Unix. The OS-9 compiler only had about 10 different error messages that it could print (I remember they were listed on a short page in the manual). ocamlopt really is miles better :-) > Unfortunately, I didn't think to start cataloging compiler error > messages and their causes when I started learning the language. > I did send one anomaly to the list about parsing of semicolons. I tell beginners that most code they write should be within a toplevel statement: let _ = ... or (better): let () = ... That basically gets rid of any ; vs ;; issues. On the subject of cataloging error messages see: http://www.ocaml-tutorial.org/common_error_messages Rich. [1] I forget the precise message because hopefully my terribly complicated dependency rules for OCaml on Fedora make it impossible to happen, so I can't recreate it here! http://fedoraproject.org/wiki/Packaging/OCaml#head-0c27c921de0c32d391ea39fffcbbacbd28ad10ca -- Richard Jones Red Hat