Version française
Home     About     Download     Resources     Contact us    
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: skaller <skaller@u...>
Subject: Re: [Caml-list] Function forward declaration?
On Thu, 2004-04-08 at 03:31, Remi Vanicat wrote:
> Richard Jones <rich@annexia.org> writes:

> 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

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

The code you have written works but it is fragile.
A more complex error check might look like this:

	if A then
		if B then error
	;

which disrupts the simple if/then/else chain.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
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