Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Undefined labels
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@m...>
Subject: Packages?
Please correct me if I'm wrong, but my understanding is that
ocaml only searches for modules referenced  like:

	open X
	..
	Y.x

in the path given to the compiler. A recent addition to Python
has helped reduce module clutter; a related idea for ocaml is
as follows: given a module name:

	X.Y.Z

X must be on the path, as before, however, if it is a directory,
it is taken to be a module containing all modules contained
in the directory: say the files are Y.cmx, Y2.cmx, then it is
as if Y and Y2 were nested in X like

	(* X.ml *)
	module Y = ..
	module Y2 = ..

Given this construction, multimodule packages can be distributed
so they unpack into a single directory, reducing name clashes,
making upgrading and removal easier, and without needing
to continually fiddle with the search path. This feature works
well in Python. It requires no changes to the language (only
some changes to the compilation model).

By default, contributed packages with install options tend to
install themselves in the same place as the standard library.
This is unfortunate, because it is useful to totally wipe out
the whole ocaml distribution and rebuild it, which clobbers
any such contributed modules.

With the package system, a symbolic link could be used to
what Python calls 'site-packages', which is where contributed
modules are installed by default. In this case, the nice feature
is that a fresh ocaml would not contain contributed packages,
but they can be reinstated by reinstalling the old symbolic link.

-- 
John Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850