-
Notifications
You must be signed in to change notification settings - Fork 404
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
utop: warning when modules collide with utop deps (will become error in 5.1) #8735
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Javier Chávarri <[email protected]>
@rgrinberg I asked you about this issue in person but I couldn't remember the solution you had nor could I find anything on it. Could you mention it here? FTR @jchavarri IIRC there is a mode for utop where it doesn't load the libraries that were used to compile it, that you have to use. I think its pretty peculiar that this is even a thing. Can't remember how to switch the mode however. |
I was talking about expunging. I don't think it would help here. I'm not sure what's the solution nor am I even certain this is a dune problem. I don't know of a way to produce a utop toplevel without linking its dependencies. @nojb any ideas perhaps? |
@jchavarri is it right that in your example in ocaml-community/utop#463, the In the toplevel, there is a way to remove module names from the global scope (expunging). In any case, note that In summary:
|
Thanks for the thorough response @nojb !
This issue was opened by @davesnx who is working on So the
This sounds exactly like what we need. And I understand that because the I found some related code in the utop repo, I understand the suggested approach would be to add
Why doesn't Dune do any expunging? I understood expunging prevents some issues with compiler-libs and other libraries, so it looked useful to have it in all cases. |
Yes. But to be clear, I am not recommending expunging as a solution (it is a hack and may have unexpected consequences). There may be other ways to work around the issue. For example, you could have a compilation unit called
I guess no one complained about it before. One downside of expunging is that it is a hack, and can sometimes produce unexpected results. For example |
@davesnx is something like this possible? |
It's possible, but I wonder if changing the interface of the package is a good solution to have it working just with utop. I can suggest to vendor React (and any other dependency) and rename it to a hard-to-collide name, maybe it's a proper solution but I raised the issue in order to have more ideas on how to fix it. |
It seems dune loads the dependencies of
utop
when runningdune utop
, which can lead to conflics for users trying to run utop sessions in projects with modules that can collision with utop deps.In 4.14, this situation triggered a warning, like this PR shows. But in 5.1 it becomes a hard error. From OCaml compiler changelog:
for ocamlc — this was already an error with ocamlopt.
(Hugo Heuzard, review by Valentin Gatien-Baron and Gabriel Scherer)