From: "David MENTRE" <david.mentre@gmail.com>
To: Ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] global record
Date: Wed, 19 Jul 2006 14:29:24 +0200 [thread overview]
Message-ID: <3d13dcfc0607190529x13465950q1216bbc275c7cef@mail.gmail.com> (raw)
In-Reply-To: <3d13dcfc0607190528y624e5c9eg2c45e1cb17ec3771@mail.gmail.com>
Oops, forgot the caml-list.
d.
2006/7/19, David MENTRE <david.mentre@gmail.com>:
> Hello,
>
> 2006/7/19, Andreas Biegert <andreas.biegert@googlemail.com>:
> > 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.
>
> <personal taste>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.</personal taste>
>
> Best wishes,
> d.
>
next prev parent reply other threads:[~2006-07-19 12:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-19 11:11 Andreas Biegert
2006-07-19 11:42 ` [Caml-list] " Pietro Abate
[not found] ` <3d13dcfc0607190528y624e5c9eg2c45e1cb17ec3771@mail.gmail.com>
2006-07-19 12:29 ` David MENTRE [this message]
2006-07-19 14:07 ` Richard Jones
2006-07-19 14:39 ` Yoann Padioleau
2006-07-19 14:50 ` Richard Jones
2006-07-19 15:09 ` Jean-Christophe Filliatre
2006-07-19 15:08 ` William D. Neumann
2006-07-20 7:26 ` Jeff Henrikson
2006-07-19 17:14 Eric Breck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3d13dcfc0607190529x13465950q1216bbc275c7cef@mail.gmail.com \
--to=david.mentre@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox