Version française
Home     About     Download     Resources     Contact us    
Browse thread
Efficiency of let/and
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Fernando Alegre <fernando@c...>
Subject: Re: Ant: [Caml-list] Efficiency of let/and

There is a small advantage in using "and" instead of "in let":

# let () =
  let x = 2 and x = 5 in ();;
This variable is bound several times in this matching
# let () =
  let x = 2 in let x = 5 in ();;

Probably the second "x" should have been a "y"... so the compiler catches
that mistake.

Fernando

> >  	let a = expr1
> >  	and b = expr2
> >  	in
> >  	...
> > 
> > rather than:
> >  	let a = expr1 in
> >  	let b = expr2 in
> > 
> > So my question is: is there any value (other than
> > the documentation value) 
> > in doing this?