caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jozef Kosoru <zyzstar@uid0.sk>
To: caml-list@inria.fr
Subject: How to define submodules
Date: Fri, 21 Jul 2006 13:53:25 +0200	[thread overview]
Message-ID: <20060721115325.GS3653@osiris.uid0.sk> (raw)

Hello,

I'm trying to split my project files into several directories but I
can't figure out how to do it right.

Let's assume the following directory structure:

	Kernel/Parser/pdf.ml
	main.ml

and let's define the content of above files as:

~~~ Kernel/Parser/pdf.ml ~~~
 let init () = print_string "hello world\n";;

~~~ main.ml ~~~
 Kernel.Parser.Pdf.init ();;

~~~

OK, and then I want to compile it (within a root directory):

	$ ocamlc -c Kernel/Parser/pdf.ml
	$ ocamlc -I . Kernel/Parser/pdf.cmo main.ml -o app

	File "main.ml", line 1, characters 0-22:
	Unbound value Kernel.Parser.Pdf.init

Is this supposed to work somehow?
I know that most ocaml programs use a bit cumbersome approach and they
define long file names to emulate submodules. Eg.

	Kernel/Parser/kernel_Parser_Pdf.ml
	main.ml

~~~ main.ml ~~~
 Kernel_Parser_Pdf.init ();;

~~~

And then:

	$ ocamlc -c Kernel/Parser/kernel_Parser_Pdf.ml 
	$ ocamlc -I . -I Kernel/Parser/ \
		Kernel/Parser/kernel_Parser_Pdf.cmo \
		main.ml -o app

but that is rather inelegant.

But ANT project [1] uses this nice syntax. For
instance, there are files:

	Engine/Evaluate.ml
	Main/Main.ml

and Main.ml calls:

	let pages = Engine.Evaluate.evaluate ast ...

is it some kind of language extension? I've noticed ANT uses a revised
OCaml syntax but there is no such a thing mentioned in its documentation
[2].

Thank you for any advice. Regards,
Jozef
	 

[1] http://ant.berlios.de/
[2] http://caml.inria.fr/pub/docs/manual-camlp4/manual007.html

-- 
jozef kosoru
http://zyzstar.kosoru.com


             reply	other threads:[~2006-07-21 11:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-21 11:53 Jozef Kosoru [this message]
2006-07-21 12:01 ` [Caml-list] " Jean-Christophe Filliatre
2006-07-21 12:42   ` Jozef Kosoru
2006-07-21 12:48     ` Nicolas Pouillard
2006-07-21 13:32     ` Chris King

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=20060721115325.GS3653@osiris.uid0.sk \
    --to=zyzstar@uid0.sk \
    --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;
as well as URLs for NNTP newsgroup(s).