From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA14939; Tue, 19 Feb 2002 13:43:35 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA12308 for ; Tue, 19 Feb 2002 13:43:34 +0100 (MET) Received: from helms1.oplayo.com (kone2.oplayo.com [212.149.66.3]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g1JChXj17802 for ; Tue, 19 Feb 2002 13:43:33 +0100 (MET) Received: from TRAVELLER ([192.168.0.89]) by helms1.oplayo.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id FG46Y2P8; Tue, 19 Feb 2002 14:45:20 +0200 Message-ID: <005101c1b943$059c6ed0$2a45fea9@TRAVELLER> Reply-To: "Dmitry Lomov" From: "Dmitry Lomov" To: "Warp" Cc: "OCaml" References: <00f901c1b93e$e95ad6c0$3c00a8c0@warp> Subject: Re: [Caml-list] Bug value Date: Tue, 19 Feb 2002 14:43:24 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2462.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2462.0000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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" To: "OCaml" 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