caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Module initialiser functions
@ 2005-08-22 11:27 Jonathan Roewen
  2005-08-22 11:38 ` Daniel Bünzli
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Roewen @ 2005-08-22 11:27 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] Module initialiser functions
  2005-08-22 11:27 [Caml-list] Module initialiser functions Jonathan Roewen
@ 2005-08-22 11:38 ` Daniel Bünzli
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Bünzli @ 2005-08-22 11:38 UTC (permalink / raw)
  To: Jonathan Roewen; +Cc: caml-list

Consult the manual,

<http://caml.inria.fr/pub/docs/manual-ocaml/manual022.html#htoc103>

Daniel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-22 11:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-22 11:27 [Caml-list] Module initialiser functions Jonathan Roewen
2005-08-22 11:38 ` Daniel Bünzli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).