[
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: | Dmitry Lomov <dsl@t...> |
| Subject: | Re: [Caml-list] Bug value |
Hello,
I assume that the answer to you problem is that such "assignments" to record
fields
occur in order deemed convenient (read: efficient) by compiler, and not
necessarily in
the order you write them in your code.
In the second snippet, compiler probably generates code in such a way that
(input_value file : finfos) occurs before (input_value file : fid).
The first snippet is _the_ way in OCaml to ensure the order of execution of
functions
with side effects, like input_value.
Hope this helps,
Friendly,
Dmitry
----- Original Message -----
From: "Warp" <warplayer@free.fr>
To: "OCaml" <caml-list@inria.fr>
Sent: Tuesday, February 19, 2002 2:13 PM
Subject: [Caml-list] Bug value
> Is the following code :
>
> let read_fdata file =
> let id = (input_value file : fid) in
> let infos = (input_value file : finfos) in
> {
> id = id;
> infos = infos;
> childs = clist;
> deps = dlist;
> }
>
> equivalent to :
>
> let read_fdata file =
> {
> id = (input_value file : fid);
> infos = (input_value file : finfos);
> }
>
> ?
> Because the first one got no problem while the second one is causing a
fatal
> bug at run-time when I try to access the struct
>
> PS :
> -----
> type fid = int
> type fver = int
> type ftype = int
> type finfos = {
> mutable name : string;
> mutable parent : fid;
> mutable ver : fver;
> mutable t : ftype;
> }
>
> Warp
>
> -------------------
> 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
-------------------
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