From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 23B64BB83 for ; Wed, 19 Jul 2006 14:29:26 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6JCTP7K001187 for ; Wed, 19 Jul 2006 14:29:25 +0200 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 OAA12309 for ; Wed, 19 Jul 2006 14:29:25 +0200 (MET DST) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k6JCTOWW001184 for ; Wed, 19 Jul 2006 14:29:24 +0200 Received: by ug-out-1314.google.com with SMTP id c2so266004ugf for ; Wed, 19 Jul 2006 05:29:24 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Xk1nUjXNghbRvw3P0Zatk+n6SnzfADH8yN4cCOa/Xjxu6FmcTWQdilj1ZmbqRFt+/CCpwZARN/AaO3N2Jt08tQh9x3eJmt1PSYJLFk7FDdaWEnKy4O8VCOrv3tjbvxXjdEU6+PyyENrIexBIa8kMAIBcnbyxFi3FbqPqqwmRIHY= Received: by 10.78.177.3 with SMTP id z3mr304080hue; Wed, 19 Jul 2006 05:29:24 -0700 (PDT) Received: by 10.78.48.6 with HTTP; Wed, 19 Jul 2006 05:29:24 -0700 (PDT) Message-ID: <3d13dcfc0607190529x13465950q1216bbc275c7cef@mail.gmail.com> Date: Wed, 19 Jul 2006 14:29:24 +0200 From: "David MENTRE" To: Ocaml Subject: Re: [Caml-list] global record In-Reply-To: <3d13dcfc0607190528y624e5c9eg2c45e1cb17ec3771@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3d13dcfc0607190528y624e5c9eg2c45e1cb17ec3771@mail.gmail.com> X-j-chkmail-Score: MSGID : 44BE25A4.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44BE25A5.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 44BE25A4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; mutable:01 params:01 foo:01 params:01 2006:98 2006:98 caml-list:01 caml-list:01 functions:01 andreas:01 andreas:01 oops:01 define:01 int:01 modules:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.9 required=5.0 tests=RCVD_BY_IP, RCVD_IN_BL_SPAMCOP_NET autolearn=disabled version=3.0.3 Oops, forgot the caml-list. d. 2006/7/19, David MENTRE : > Hello, > > 2006/7/19, Andreas Biegert : > > Is > > there a way to make the (possibly modified) parameters record globally > > accessable throughout all modules? > > Define a global variable in the Par module, use it in the other modules. > > ==par.ml== > type param = { mutable a: int; } > > let params = { a = 3; } > == > > ==foo.ml== > let bar = Par.params.a > > let _ = Par.params.a <- bar + 1 > == > > > This would be much more convenient > > than having to pass the parameters record to virtually all functions > > in my application. > > I find this purely functional approach much cleaner > because you know where your global variables are read or modified > directly by looking at function parameters. > > Best wishes, > d. >