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 UAA30612; Wed, 7 Apr 2004 20:44:24 +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 UAA30514; Wed, 7 Apr 2004 20:44:23 +0200 (MET DST) Received: from pedigree.cs.ubc.ca (pedigree.cs.ubc.ca [142.103.6.50]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i37IiLYM002988; Wed, 7 Apr 2004 20:44:22 +0200 Received: from cascade.cs.ubc.ca (cascade.cs.ubc.ca [142.103.7.7]) by pedigree.cs.ubc.ca (8.12.10/8.11.4) with ESMTP id i37IiGXd024006; Wed, 7 Apr 2004 11:44:16 -0700 (PDT) Date: Wed, 7 Apr 2004 11:44:16 -0700 (PDT) From: Christopher Dutchyn To: Basile Starynkevitch cc: Richard Jones , caml-list@inria.fr Subject: Re: [Caml-list] Function forward declaration? In-Reply-To: <20040407172648.GA12511@bourg.inria.fr> Message-ID: References: <60532B15DF92FD4693AA89B2F7E01D8F013F29EC@tmex02> <00cf01c41bd6$391b53a0$0203a8c0@hoedic> <20040406175320.GA19840@redhat.com> <1081279717.16531.6.camel@qrnik> <002901c41c65$b53e4c50$19b0e152@warp> <1081345936.19232.579.camel@pelican> <20040407141519.GA6618@redhat.com> <20040407172648.GA12511@bourg.inria.fr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; ubc:99 caml-list:01 basile:01 camlp:01 val:01 val:01 camlp:01 ubc:99 chris:01 syntax:02 syntax:02 identical:03 revised:03 revised:03 wrote:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 105 On Wed, 7 Apr 2004, Basile Starynkevitch wrote: > For your information, the revised syntax (provided by camlp4) does > have (IIRC) a return keyword (but I don't remember more, and I never > used it). The return keyword in the revised syntax does not do what Richard wants. In particular, the revised syntax supports (as deprecated syntax) do 1; 2; return 3 as an expression. Note that return is used solely to mark the terminal expression in the sequence, not to obtain an early exit. Specifically, it allows one to omit the braces from the identical expression: do { 1; 2; 3 } In particular, this doesn't work let i = ref 10 in while (i.val = 0) do { if i.val = 7 then return i.val (* or blank or anything *) else i.val := i.val - 1 } Interestingly, the deprecated syntax is not included in the reference and tutorial manuals for camlp4. Chris Dutchyn cdutchyn@cs.ubc.ca ------------------- 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