[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ 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 <checker@d6.com> 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
condition.
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
right).
But then again, it could be different in bytecode and in native code.
Friendly,
Sven Luther
-------------------
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