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
ocamlbuild _tag equivalent to "-open M" #6584
Comments
Comment author: @gasche As a matter of fact, the exact syntax you use is supported right now in 4.02.0: there is an However, what open() does not do is marking the module passed as a dependency of the modules to which it is applied. This means that using open() with a name of a module developed in the same project may not work, if ocamlbuild has no way to guess that this is a dependency. Consider for example: a.ml: b.ml: Then just using _tags: will not work as-is because ocamldep (and thus ocamlbuild) will not magically guess that b.ml depends on a.cm{i,o}, and compilation will fail. However let y = A.x (* or anything that creates an explicit dependency *) would work, and, without changing the original b.ml: myocamlbuild.ml: open Ocamlbuild_plugin;; let _ = dispatch begin function _tags: also works. I think we might want consider this a bug report indicating that |
Comment author: @hcarty Ah, I had not tried it. "ocamlbuild -documentation |grep open" doesn't show the flag. Documenting the dependency limitation and including "depends" or its equivalent out of the box would be a nice. Finally - with this new feature, would it make sense to include an implicit "-open Ocamlbuild_plugin" when myocamlbuild.ml is compiled? |
Comment author: @gasche
Yes, this is unfortunate. -documentation doesn't say anything about parametrized flags, because it's unclear what could be said. (One idea would be to call them with dummy string values and sort of see what happens, but that's an idea I find rather doubtful).
There is a bugfix release coming. If there is a simple way to fix the limitation, we should definitely go for it. "depends" is useful in isolation but we would need something more complete to include (above it only handles compilation and linking). Would you open another PR for this?
I personally think "-open" is going in the wrong direction: we should take back control of the semantics of our program from the command-line, rather than give it more power over our code. It was included to be used in very specific use-cases (large-scale -no-alias-deps mapping files) and we lack experience to see where it is nice and where it hurts. I think that's too early. |
Comment author: @gasche The underlying dependency-computation issue is now resolved in 4.02 and trunk, by adding support for the "-open M" flag in ocamldep itself (and then simply having ocamlbuild pass this flag to ocamldep). This should help other ocamldep-relying systems as well. |
Original bug ID: 6584
Reporter: @hcarty
Assigned to: @gasche
Status: closed (set by @xavierleroy on 2016-12-07T10:36:45Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 4.02.0+beta1 / +rc1
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues
Monitored by: @ygrek @hcarty
Bug description
It would be nice to have a matching flag to set in _tags to match the functionality of the new-in-4.02.0 "-open" command line argument. Something similar to:
_tags:
true: open(M)
The text was updated successfully, but these errors were encountered: