Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jonathan Roewen <jonathan.roewen@gmail.com>
To: caml-list@yquem.inria.fr
Subject: [Caml-list] Module initialiser functions
Date: Mon, 22 Aug 2005 23:27:03 +1200	[thread overview]
Message-ID: <ad8cfe7e05082204271e69a0eb@mail.gmail.com> (raw)

Hi,

Is it guaranteed that the initialisers for each module will be run in
the order of modules specified to the ocaml compiler?

Say, with the given Makefile:

ML	 = ocaml/device.ml ocaml/keyboard.ml ocaml/console.ml
ocaml/thread.ml ocaml/irq.ml ocaml/kernel.ml
MLI	 = $(wildcard ocaml/*.mli)
CMX	 = $(ML:.ml=.cmx)

OCAMLKERNEL	= ocaml/ocamlkernel.o

$(OCAMLKERNEL): $(CMX)
	$(OCAMLOPT) -linkpkg $(CMXA) $(CMX) -output-obj -o $@

For instance: I want to have it such that keyboard.ml registers a
device during init, and then console.ml registers a device which
depends on opening the keyboard device earlier registered.

But the only way this is guaranteed to work is if I can make some sort
of guarantees about the order that initialisers are called at the
module level. Does ocaml make any sort of guarantees like this? Or
will depending on this to happen be too fragile?

Jonathan


             reply	other threads:[~2005-08-22 11:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-22 11:27 Jonathan Roewen [this message]
2005-08-22 11:38 ` Daniel Bünzli

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=ad8cfe7e05082204271e69a0eb@mail.gmail.com \
    --to=jonathan.roewen@gmail.com \
    --cc=caml-list@yquem.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