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 FAA03369; Fri, 5 Mar 2004 05:42:49 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 FAA03299 for ; Fri, 5 Mar 2004 05:42:47 +0100 (MET) Received: from nexus.stwing.upenn.edu (NEXUS.STWING.UPENN.EDU [165.123.132.61]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i254gxIq011152 for ; Fri, 5 Mar 2004 05:42:59 +0100 Received: from force.stwing.upenn.edu (root@force.stwing.upenn.edu [165.123.132.65]) by nexus.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id i254gjiV014931 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Mar 2004 23:42:45 -0500 (EST) Received: from force.stwing.upenn.edu (wlovas@localhost [127.0.0.1]) by force.stwing.upenn.edu (8.12.10/8.12.9) with ESMTP id i254gioO002911 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Mar 2004 23:42:44 -0500 (EST) Received: (from wlovas@localhost) by force.stwing.upenn.edu (8.12.10/8.12.9/Submit) id i254gh5D002910; Thu, 4 Mar 2004 23:42:43 -0500 (EST) Date: Thu, 4 Mar 2004 23:42:43 -0500 From: William Lovas To: Vasili Galchin Cc: caml-list@inria.fr Subject: Re: [Caml-list] Test case syntax error Message-ID: <20040305044242.GA2807@force.stwing.upenn.edu> Mail-Followup-To: Vasili Galchin , caml-list@inria.fr References: <20040305032546.43655.qmail@web41206.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040305032546.43655.qmail@web41206.mail.yahoo.com> User-Agent: Mutt/1.5.4i X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; lovas:01 wlovas:01 stwing:01 caml-list:01 2004:99 trimming:01 buffer:01 recvfrom:01 buffer:01 let':01 ocamlc:01 verbose:01 o'caml's:01 compiler:01 compiler:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Keywords: X-UID: 50 On Thu, Mar 04, 2004 at 07:25:46PM -0800, Vasili Galchin wrote: > 1) It gets a syntax error on the ending "done" for the > "while true". I have tried trimming down and still the > syntax error. I am sorry for something so elementary. > Can anyone help? Let's look at the code: > while true do > let (buffer:string) = "" in > (* Do blocking read! *) > let (x, y) = Unix.recvfrom descr buffer 0 128 [MSG_OOB] > done An expression belongs inside the `do ... done' of a while loop, and any `let' expression needs an `in'. (Be careful not to confuse the `let ... in ...' _expression_ with the `let ...' _top-level declaration_.) What do you want to do with that (x, y) pair after you've bound it? > 2) I am running on Linux. I did a "man ocamlc" to see > what kind of compiler switches there are. Is there a > compiler switch that gives a more verbose/helpful > error than simply "syntax error"? None that i'm aware of, but after you spend enough time with O'Caml's syntax, the location of the error is usually enough. cheers, William ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners