Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Function forward declaration?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Remi Vanicat <remi.vanicat@l...>
Subject: Re: [Caml-list] Function forward declaration?
Richard Jones <> writes:

> 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 do it without return nor exception :

let run dbh q userid =
  if check_permissions userid = Failed then (
    StdPages.error q "Sorry, but you don't have permission to see this"
  ) else
  let query = q#param "query" in

  if query =~ /^\s*$/ then (
    StdPages.error q "Please enter a query"
  ) else

  let resource =
    try find_resource dbh query
      Not_found ->
	StdPages.error q "That resource doesn't exist in the database"

  (* Do lots and lots of real processing here. *)

  StdPages.ok q "OK, your query was executed"

I don't see what is your problem here...

Rémi Vanicat

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: