List Info

Thread: Re: "ocaml_beginners"::[] no implementations provided




Re: "ocaml_beginners"::[] no implementations provided
country flaguser name
United States
2007-02-27 22:50:10



--- In ocaml_beginners%40yahoogroups.com">ocaml_beginnersyahoogroups.com, Jon Harrop <jon...> wrote:
&gt; Which is the correct or desired solution? You can't know, and neither can the
> compiler but ocamldep can guess (and get it wrong).

Of course you know what your program should do or print ! There
are two kinds of order constraints for compilation : those that the user
must provide explicitly to the compiler (as in your example) and
those that can be deduced automatically by ocamldep by scanning the files. My
point was that there is no reason to force the user to worry
about the latter. In an imaginary world,
the command dealing with your example would be

ocamlc -a -additional_constraints "please compile a before b !"
-o my_library.cma x.cmo b.cmo y.cmo z.cmo a.cmo

(or "please compile b before a!", depending on what you want your program to do).

> Which of the two possible solutions above is the "unique arbitrary&quot; solution?

In mathematical terms, the idea is this : there is a partial ordering
(the initial "dependency constraints") on the
set of all the files to be compiled, and you must extend it to a total ordering.
The algorithm is to take a f1 that does not depend on any other module,
then a f2 in the remaining that does not depend on anything but f1, etc.
(if you insist on uniqueness, take f1 to be "minimal" among the independent
modules with respect to file creation date, lexicographic order on filenames, or your
favorite total order).

Ewan

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] no implementations provided
country flaguser name
United Kingdom
2007-02-27 23:34:20

On Wednesday 28 February 2007 04:50, roparzhhemon wrote:
&gt; ocamlc -a -additional_constraints "please compile a before b !"
> -o my_library.cma x.cmo b.cmo y.cmo z.cmo a.cmo
&gt;
> (or "please compile b before a!", depending on what you want your program
> to do).

Exactly. And the way we confer "please compile b before a!" to the compiler is
by writing:

ocaml b.ml a.ml -o barfoo

> > Which of the two possible solutions above is the "unique arbitrary&quot;
>; > solution?
>
&gt; In mathematical terms, the idea is this : there is a partial ordering
> (the initial "dependency constraints") on the
> set of all the files to be compiled, and you must extend it to a total
&gt; ordering. The algorithm is to take a f1 that does not depend on any other
&gt; module, then a f2 in the remaining that does not depend on anything but f1,
> etc. (if you insist on uniqueness, take f1 to be "minimal" among the
> independent modules with respect to file creation date, lexicographic order
&gt; on filenames, or your favorite total order).

The problem is that you cannot infer the true dependencies from the code, e.g.
in my example. You can only guess as ocamldep does or ask the user to be
explicit, as ocamlc and ocamlopt do.

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )