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

MPR#5547: Enable the "-use-ocamlfind" option by default #214

Open
damiendoligez opened this issue Mar 3, 2017 · 9 comments
Open

MPR#5547: Enable the "-use-ocamlfind" option by default #214

damiendoligez opened this issue Mar 3, 2017 · 9 comments

Comments

@damiendoligez
Copy link
Member

damiendoligez commented Mar 3, 2017

PR transferred from https://caml.inria.fr/mantis/view.php?id=5547
[original reporter: @gasche ]

Ocamlfind is everywhere these days and I frequently forget to add the -use-ocamlfind knob to enable the nifty package(foo) syntax. I'm not sure why it was enabled by default (maybe there was a conflict in semantics somewhere) but I would like it if it became the standard (with why not an opt-out option -no-ocamlfind).

It would be useful in particular when used with Oasis, which currently has the limitation that we can't pass command-line parameters to the ocamlbuild invocation directly. That's a bug that will eventually be fixed, but there may be similar situations present in other tools.


See also the (very long) discussion in the Mantis PR.

@gasche
Copy link
Member

gasche commented Mar 3, 2017

To summarize: at the time where we first attempted to make -use-ocamlfind the default, we conducted the change rather poorly: we tried to make it the default in the same new version that introduced the -no-ocamlfind flag to revert to the old behavior, making it impossible for the no-ocamlfind people to write build configurations that would be compatible with older OCaml(build) versions.

Now that we have had quite a few releases with the -no-ocamlfind present, it is possible to consider doing this again. A question is whether the no-ocamlfind crowd are still trying to support OCaml versions whose associated ocamlbuild does not have the -no-ocamlfind flag. Given that this flag was introduced in 4.01.0, that sounds increasingly unlikely.

There is also the question of whether we think that it is a good change to make. One thing I understood while discussing the issues with my colleagues at the time is that we should be very, very careful about changing a default (it is a more disruptive change that one would expect), so it should only be done when there is a very strong reason to do so. I happen to think, in the context of -use-ocamlfind, that there is a very strong reason to do so, which is that 99% of our users use ocamlbuild and ocamlfind together. (Of course, one could argue that 90% of our users use them through Oasis and don't actually care about the direct ocamlbuild interface.). That does not mean setting ocamlfind in stone forever (if tomorrow 99% of our users use another system to manage their compilation unit namespaces, we can discuss another change).

@dbuenzli
Copy link
Collaborator

dbuenzli commented Mar 3, 2017

Related to #48 and #185.

On my side I would nowadays be for the change. All the automated invocation I propagated in the eco-system (through topkg) are explicit about the matter and use -use-ocamlfind and I won't change this.

For sure there will be a break here or there but I don't expect them to be that widespread. We should just make sure the error message is good when you ocamlbuild and there's no ocamlfind to be seen in $PATH.

I think it's really nice for end-users to just have that bit.ml here and be able to compile it in the eco-system using ocamlbuild -pkgs bli,bla,blo bit.native. I myself often have to invoke this twice, once to get an error and a second time to add the -use-ocamlfind.

@gasche
Copy link
Member

gasche commented Mar 3, 2017

I feel that there is some consensus on changing the default, but I don't want to do this for 0.11, we have enough potentially-breaking stuff to deal with.

@dbuenzli
Copy link
Collaborator

dbuenzli commented Mar 3, 2017

We should just make sure the error message is good when you ocamlbuild and there's no ocamlfind to be seen in $PATH.

Regarding this there should be a discussion about whether ocamlbuild should then opam-depend on ocamlfind or not (it should at least be in the depopts). I would be in favour of making ocamlbuild dependent on ocamlfind to avoid this bad UX.

@gasche
Copy link
Member

gasche commented Mar 3, 2017

deopts, certainly. I guess we could do the change today. But what is the semantics? Recompile if ocamlfind gets installed later? We don't need that.

As a dependency, there is the cost that no-ocamlfind people would frown on that -- and, again, it's easy to write a clear error message when an ocamlbuild command relies on ocamlfind but it is missing. I'm not sure that having the dependency is the best choice.

@bluddy
Copy link

bluddy commented Mar 3, 2017

Is it possible for ocamlbuild to register as 2 packages in opam? One would be the default one and would depend on ocamlfind, and the other would be for experts ('ocamlbuild_no_ocamlfind') and not depend on it?

It would be nice if a command line switch could emulate this opam behavior for one package (e.g. building with --no-ocamlfind would remove the dependency on ocamlfind), but the more primitive 2 package solution would do the trick as well.

@gasche
Copy link
Member

gasche commented Mar 3, 2017

I think that would work, but I'm not sure it is worth the hassle from a packaging/release point of view. Plus all the no-ocamlfind users would have to update their own opam files to use ocamlbuild_no_ocamlfind instead. This is a possible compatibility path if we decide to have the dependency by default.

(Another argument for not having the dependency is that most other packages out there do depend on ocamlfind, at least at build time, so it is super-likely that any "normal user" will have ocamlfind installed anyway. I think the situation is more likely to occur when super-user experiment with OCaml beta releases, or custom switches, or weird stuff, in which case maybe a clear error message is enough UX.)

@dbuenzli
Copy link
Collaborator

dbuenzli commented Mar 6, 2017

Plus all the no-ocamlfind users would have to update their own opam files to use ocamlbuild_no_ocamlfind instead.

Is there a proof of existence of no-ocamlfind users ?

@dbuenzli
Copy link
Collaborator

dbuenzli commented Mar 6, 2017

I mean if I can tell a newcomer to simply opam install ocamlbuild so that she can ocamlbuild mybit.native I'm more happy than if I have to explain her that she will have to opam install ocamlfind ocamlbuild because for some reason by default ocamlbuild doesn't work if ocamlfind is not installed and this is not expressed in the dependencies of the package.

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

4 participants