Commit f4390675 authored by POTTIER Francois's avatar POTTIER Francois

Removed my recent big comment on --depend, which was mostly wrong.

parent 4b46e509
* understand whether/why --depend needs a mock [.mli] file too
* Confirm and understand why the code back-end slows down by 50% * Confirm and understand why the code back-end slows down by 50%
between 4.01.0 and 4.02.1. Use the tag last309 for this purpose, between 4.01.0 and 4.02.1. Use the tag last309 for this purpose,
or the master branch. or the master branch.
......
...@@ -80,8 +80,8 @@ let () = ...@@ -80,8 +80,8 @@ let () =
(* ------------------------------------------------------------------------- *) (* ------------------------------------------------------------------------- *)
(* If [--depend] was specified on the command line, perform dependency (* If [--depend] or [--raw-depend] was specified on the command line,
analysis and stop. *) perform dependency analysis and stop. *)
let () = let () =
match Settings.depend with match Settings.depend with
...@@ -91,37 +91,12 @@ let () = ...@@ -91,37 +91,12 @@ let () =
| Settings.OMNone -> | Settings.OMNone ->
() ()
(* [--depend] is really a strange hack: we are expected to be able to predict (* The purpose of [--depend] and [--raw-depend] is to support [--infer].
the dependencies exhibited by the [.ml] and [.mli] files produced by Indeed, [--infer] is implemented by producing a mock [.ml] file (which
Menhir, *without* actually producing these files, because we cannot yet contains just the semantic actions) and invoking [ocamlc]. This requires
produce them. (If [--infer] is enabled, producing these files would require certain [.cmi] files to exist. So, [--depend] is a way for us to announce
consulting certain [.cmi] files that may not exist yet.) *) which [.cmi] files we need. It is implemented by producing the mock [.ml]
file and running [ocamldep] on it. *)
(* Remarks. 1- If [make] was not brain-dead, we would not have to do this in
the first place. A good compilation manager should be able to mix the
production of targets and the dependency analysis. Apparently, by this
definition, [ocamlbuild] is brain-dead too: it uses [menhir --raw-depend].
2- We are able to do this because we can produce mock [.ml] and [.mli]
files that exhibit the same dependencies as the real ones. This allows us
to run [ocamldep] on these mock files and obtain correct depdendency
information. Traditionally, our mock [.mli] file was in fact the final
[.mli] file, and our mock [.ml] file contained just the semantic actions
and nothing else. (But see 4- below.)
3- If both [--depend] and [--infer] are enabled, we must effectively ignore
[--infer] and perform the dependency computation without attempting to
perform type inference. Indeed, as mentioned above, that would require
consulting certain [.cmi] files that may not exist yet.
4- As of 2014/12/17, we would like to produce as part of the [.mli] file
a type [nonterminal] which lists all nonterminal symbols together with
their OCaml type. This typically requires [--infer]. Thus, this implies
that the mock [.mli] file can no longer be the same as the final [.mli]
file; the mock cannot contain the type [nonterminal]. As a result, maybe
the dependencies (computed based on the mock) will be incomplete. Which
would be a problem (failure to build). I am not sure at the moment how
to address this problem. *)
(* ------------------------------------------------------------------------- *) (* ------------------------------------------------------------------------- *)
......
...@@ -242,11 +242,10 @@ let depend grammar = ...@@ -242,11 +242,10 @@ let depend grammar =
print_string output; print_string output;
(* If [--raw-depend] was specified on the command line, stop here. (* If [--raw-depend] was specified on the command line, stop here. This
This option is used by omake, which performs its own option is used by omake and by ocamlbuild, which performs their own
postprocessing of [ocamldep]'s output. For normal [make] users, postprocessing of [ocamldep]'s output. For normal [make] users, who use
who use [--depend], some postprocessing is required, which is [--depend], some postprocessing is required, which is performed below. *)
performed below. *)
begin match Settings.depend with begin match Settings.depend with
| Settings.OMNone -> | Settings.OMNone ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment