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
RE: [Caml-list] eval order and 'and'
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sven LUTHER <luther@d...>
Subject: Re: [Caml-list] eval order and 'and'
On Wed, Sep 11, 2002 at 01:05:46AM -0400, Arturo Borquez wrote:
> Chris Hecker <> wrote:
> >
> >Does "let a and b in" guarantee a is evaluated before b, like "let a in let 
> >b in" does?
> >
> Sorry but I don't understand the purpose of your question.
> If a and b are functions with 'related side effects' the secure
> way should be the later ('let a in let b ..'), otherwise
> the order of evaluation in the first case is irrelevant
> as a and b are two unrelated functions (with no side effects),
> or 'let a and b in ..' is the same as 'let b and a in ..' 

So he can do things like :

if x <> 0 and 1 / x ... 

like it is possible to do in C, instead of doing :

if x <> 0 then if 1 / x ...

which gives more lines of code, and needs to redefine two time the else

Anyway, i don't think the order is defined, but in any case, i guess
it would be revere sequential if anything (execution starts from the

But then again, it could be different in bytecode and in native code.


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