-
Notifications
You must be signed in to change notification settings - Fork 414
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
Add convenience targets for .cmx/.cmo? #1630
Comments
Initially we were generating these files in the source directory, then when we moved them to the object directory, we initially add copy rules for backward compatibility. We dropped these when switching to Dune as we observed that doing so resulted in a noticeable speedup. We could re-introduce them, but we'd have to make sure they don't slow down things. Alternatively, one idea would be to have a notion of target proxies. I.e. we could use convenient target names that don't exist and Dune would print what they actually mean:
The main difference would be that the resolution of these names would be done lazily, while if we setup actual rules, we have to do more work eagerly. |
Thanks for the explanation. I agree the lazy approach is better. |
Why can't you rely on merlin to check a single module? I'm not a huge fan of introducing these targets because they're too low level. It's not really clear for a user when they should build the .cmo vs. the .cmx target to "error check" their module. Not to mention that these targets create even more backwards compatibility obligations for us. I think if we really wanted something like it would be better to have aliases for these kinds of targets. |
We just talked about this with @rgrinberg offline. If these targets are only available from the command line, it doesn't create much backward compatibility obligations. But it's true that for someone who is not familiar with OCaml compilation, these might be hard to discover. Another possibility would be to have virtual targets for module names, i.e.
Similarly, |
I've written up an RFC for a more heavyweight but also more widely applicable solution here: |
Coming back to this after after having experimented a bit more, I still think having a way for the command-line tool to build convenience names like Unless there is strong opposition I will try to give this a shot whenever I get some free time. |
Okay, but diml's suggestion can be folded over into #1648 pretty easily. For example, we could have:
Modules aren't the only alternative way of referring to build artifacts so let's be considerate of that. Update: In fact you could also add support for |
I suppose the two make sense: experts would likely prefer Personally, I'm fine with supporting both as long as introducing these convenient names doesn't impact performances of normal builds. |
What do you think about adding a convenience target in the source directory for
.cmx
and.cmo
files? It is convenient in large codebases to check compilability of a single module without having to compile anything else. Right now one needs to know the library or executable the module belongs to in order to deduce the path in the build directory, which is not practical.The text was updated successfully, but these errors were encountered: