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 TAA07695; Tue, 1 Jun 2004 19:43:06 +0200 (MET DST) 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 TAA07921 for ; Tue, 1 Jun 2004 19:43:05 +0200 (MET DST) Received: from calmail-cr.berkeley.edu (mailfarm.Berkeley.EDU [128.32.61.106]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i51Hh4EV019589 for ; Tue, 1 Jun 2004 19:43:04 +0200 Received: from [64.162.212.212] (HELO tallman.kefka.frap.net) by calmail-cr.berkeley.edu (CommuniGate Pro SMTP 4.1.8) with SMTP id 34793536; Tue, 01 Jun 2004 10:43:03 -0700 Received: by tallman.kefka.frap.net (sSMTP sendmail emulation); Tue, 1 Jun 2004 10:40:14 -0700 Date: Tue, 1 Jun 2004 10:40:14 -0700 From: Kenneth Knowles To: John Goerzen Cc: caml-list@inria.fr Subject: Re: [Caml-list] Strange syntax behavior Message-ID: <20040601174014.GA9577@tallman> References: <20040601171354.GA16495@excelhustler.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040601171354.GA16495@excelhustler.com> User-Agent: Mutt/1.5.6i X-Miltered: at nez-perce with ID 40BCC028.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; knowles:99 caml-list:01 2004:99 parentheses:01 analogous:01 indentation:01 syntax:02 constructs:02 constructs:02 match:02 essentially:02 wrote:03 behavior:03 raise:05 raise:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Jun 01, 2004 at 12:13:54PM -0500, John Goerzen wrote: > In the case of if...then...else, the else clause appears to consume only > the first statement following. With try..with, the with clause appears > to consume everything it possibly can, despite even attempts to stop > that with a begin..end clause. You'll need (try raise Not_found with Not_found -> p "exc"); p "done";; I'd guess the reason the precedence is such is to require as few parentheses as possible. Most uses of try or match are not in a sequence of expressions, while many if-then-else expressions are. Essentially, matching constructs and if constructs are not analogous. Examples with clear indentation: if true then p "yes" else p "no"; p "done" if true then p "yes" else ( p "no"; p "done" ) try raise Not_found with | Not_found -> p "exc"; p "done" (try raise Not_found with | Not_found -> p "exec"); p "done" Kenn ------------------- 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