Version française
Home     About     Download     Resources     Contact us    
Browse thread
Ocaml compiler features
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: tab@s...
Subject: Re: [Caml-list] Ocaml compiler features
On Mon, Jan 15, 2007 at 10:36:02AM +0000, Richard Jones wrote:
> Hmmm .. changing the precedence of operators to avoid two parentheses ...
> I don't think that's good.
> 
> if y=1 then (
> 	let z = 2 in
> 	print_int y;
> 	print_int z;
> ) else
> 	print_string "not one"
> 
> I will however add my own pet wish: a 'return' statement!  It doesn't
> have to break type safety -- you should only be allowed to 'return' a
> type compatible with the ordinary return type of the function.  The
> alternative (using exceptions to jump out of code) is ugly, slow and
> unsafe.

I agree, I cannot think of a bad way to use it, and it would be more
useful than having one more nested if then else or an exception mechanism.

(the only problem I'm seeing if that people will use this return
statement at the end of function)

Xavier, if somebody does a patch to do that or some other useful feature,
would that be considered for entering CAML's CVS ?
(i.e. what are the rules for accepting a patch ?)

Cheers,
-- 
Vincent Hanquez