You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When dealing with parser.mly, currently ocamlbuild invokes menhir --raw-depend in order to compute the dependencies of parser.{ml,mli} before these files are produced.
It seems to me (but I could be wrong) that instead ocamlbuild could first build these two files (by invoking menhir normally) then compute their dependencies (by invoking ocamldep).
That would be desirable, because menhir --(raw-)depend is a hack (trying to predict accurate dependencies before we actually produce the files) which may become more difficult to maintain in the future (due to addition of new features in Menhir).
What do you think?
Francois.
The text was updated successfully, but these errors were encountered:
Now that I think of it, --raw-depend is useful if you use --infer (OCaml won't be able to type-check the code if the interface of the module dependencies are not already compiled), which was the default in ocamlbuild-menhir's integration. This changed fairly recently thanks to Hugo Heuzard in #6237, which made using --infer optional. In the menhir manual, --infer is marked "strongly recommended", do you think it would be better for ocamlbuild to use neither --infer nor --raw-depend?
(If the point of --infer is only the better error messages, we could conceivably try to first call menhir without it, then compute dependencies and compile the resulting .ml, and then call menhir --infer back if .ml compilation failed. That looks a bit too complex to my taste. Or maybe we could make sure menhir uses the proper lexer directives to make sure --infer isn't actually necessary to get good error messages?)
In my mind, --infer is highly desirable (in fact, some of the new features of Menhir will depend on it). ocamlbuild should use it by default.
I don't see why it is useful to disable it... (but ok, if some people want that, why not).
I guess I was confused in my original post. You are right: the point of menhir --raw-depend is not to predict ahead of time the dependencies that will be found by inspecting parser.{ml,mli}. (Those would be the dependencies of parser.cmi, etc.) The point is to tell ocamlbuild which files need to be compiled before menhir can produce parser.{ml,mli}. (These are the dependencies of parser.{ml,mli}.)
OK, so, probably there is no need to change anything. Thanks and sorry for the noise.
Original bug ID: 6724
Reporter: @fpottier
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2016-12-07T10:37:15Z)
Resolution: not a bug
Priority: normal
Severity: feature
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Bug description
When dealing with parser.mly, currently ocamlbuild invokes menhir --raw-depend in order to compute the dependencies of parser.{ml,mli} before these files are produced.
It seems to me (but I could be wrong) that instead ocamlbuild could first build these two files (by invoking menhir normally) then compute their dependencies (by invoking ocamldep).
That would be desirable, because menhir --(raw-)depend is a hack (trying to predict accurate dependencies before we actually produce the files) which may become more difficult to maintain in the future (due to addition of new features in Menhir).
What do you think?
Francois.
The text was updated successfully, but these errors were encountered: