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 SAA21999; Wed, 7 Apr 2004 18:41:24 +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 SAA22023 for ; Wed, 7 Apr 2004 18:41:23 +0200 (MET DST) Received: from aomori.annexia.org (annexia.force9.co.uk [212.56.101.183]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i37GgGjq031341 for ; Wed, 7 Apr 2004 18:42:16 +0200 Received: from rich by aomori.annexia.org with local (Exim 3.36 #1 (Debian)) id 1BBG78-0002SX-00 for ; Wed, 07 Apr 2004 17:41:22 +0100 Date: Wed, 7 Apr 2004 17:41:22 +0100 Cc: caml-list Subject: Re: [Caml-list] Function forward declaration? Message-ID: <20040407164122.GA9247@redhat.com> 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> <1081353080.19232.678.camel@pelican> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1081353080.19232.678.camel@pelican> User-Agent: Mutt/1.5.5.1+cvs20040105i From: Richard Jones 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.05; caml-list:01 2004:99 'return':99 dbh:99 userid:99 permissions:01 userid:99 dbh:99 pseudocode:01 clumsy:01 team's:01 ltd:98 ocaml:01 ocaml:01 wrote:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 96 On Thu, Apr 08, 2004 at 01:51:21AM +1000, skaller wrote: > > (Same, by the way, goes for a 'return' statement which OCaml is crying > > out for). > > I don't think it makes any sense in Ocaml. [...] This is the sort of thing which I'd like to write. Note not only the return statement, but also the regular expression support: let run dbh q userid = if check_permissions userid = Failed then ( StdPages.error q "Sorry, but you don't have permission to see this"; return ); let query = q#param "query" in if query =~ /^\s*$/ then ( StdPages.error q "Please enter a query"; return ); let resource = try find_resource dbh query with Not_found -> StdPages.error q "That resource doesn't exist in the database"; return in (* Do lots and lots of real processing here. *) StdPages.ok q "OK, your query was executed" ----- That's pseudocode of course, and I'm not saying that it isn't possible to do this in OCaml already using exceptions, but doing so is very clumsy compared to having a return statement (and indeed regular expression support). Rich. -- Richard Jones. http://www.annexia.org/ http://www.j-london.com/ Merjis Ltd. http://www.merjis.com/ - improving website return on investment 'There is a joke about American engineers and French engineers. The American team brings a prototype to the French team. The French team's response is: "Well, it works fine in practice; but how will it hold up in theory?"' ------------------- 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