Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could ocamlbuild NOT rely on menhir --(raw-)depend? #6724

Closed
vicuna opened this issue Dec 18, 2014 · 2 comments
Closed

Could ocamlbuild NOT rely on menhir --(raw-)depend? #6724

vicuna opened this issue Dec 18, 2014 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Dec 18, 2014

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.

@vicuna
Copy link
Author

vicuna commented Dec 18, 2014

Comment author: @gasche

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?)

@vicuna
Copy link
Author

vicuna commented Dec 18, 2014

Comment author: @fpottier

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.

Francois.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants