melange-community / melange-webapi

Melange bindings to the DOM and other Web APIs
MIT License
15 stars 6 forks source link

Does this genuinely require OCaml 5.1? #14

Closed aantron closed 8 months ago

aantron commented 8 months ago

I haven't looked into it in detail, but I suspect this constraint is too aggressive. It is presently causing a minor inconvenience in Dream's examples and CI.

jchavarri commented 8 months ago

Unfortunately Melange has its own fork of OCaml compiler libs, and it's not trivial to support multiple versions of the OCaml compiler without breaking tooling like odoc or merlin/lsp, or adding a lot of maintenance overhead (there would need to be one version of Melange for each version of OCaml, e.g. melange-2.0-ocaml-4.14, melange-2.0-ocaml-5.0, melange-2.0-ocaml-5.1...

So Melange v2 is compatible with just OCaml 5.1. Most probably as we release new versions of Melange the range of OCaml versions supported will increase.

I am not sure what the fix can be. Probably have the Dream examples that depend on Melange to run only on 5.1 on CI...

cc @anmonteiro

jchavarri commented 8 months ago

Btw, on most recent releases of Melange libraries, I am leaving the dep on ocaml "float" on the library opam (no constraint), so that the constraint on ocaml is defined only on melange itself, see https://github.com/ocaml/opam-repository/pull/24643#discussion_r1366514968.

aantron commented 8 months ago

Yes. If the library doesn't use specific features of OCaml 5.1, it should have a relaxed constraint. It should be possible to use the library with the lowest versions of OCaml and Melange that are actually required by the code of the library itself, and let the package manager figure out what versions of these deps to install and what the constraints between them are. Unless therre is something in melange-webapi 5.1 that absolutely requires the latest OCaml, this constraint is too aggressive and prevents useful installations of the library that would have worked.

jchavarri commented 8 months ago

I don't think I was clear.

The version of melange-webapi does not use anything from OCaml 5.1, but it is only compatible with Melange v2, which included breaking changes on the way bindings are defined.

So removing the ocaml constraint on melange-webapi will not change anything really. The library is not usable from OCaml 5.0 or earlier versions, because Melange v2 is only compatible with OCaml 5.1.

jchavarri commented 8 months ago

I think this issue should be opened on Melange repository, not here.

aantron commented 8 months ago

I did understand that and looked at the change, thank you! The constraint here is only redundant and misleading, and I think there is no actual issue, netiher here nor in Melange :) Thanks again!

jchavarri commented 8 months ago

Just curious, how did you work around the issues in CI you were facing in Dream?

Fwiw, I removed the ocaml constraint in https://github.com/melange-community/melange-webapi/pull/15, so the next released version of melange-webapi in the opam repository won't include it.

Regarding the generic issue, it would be great if Melange could support a broader range of versions of the underlying OCaml compiler while supporting packages like odoc and merlin/lsp. Unfortunately, I am not sure we have figured out a way to do this though. I started an issue in https://github.com/melange-re/melange/issues/886.

aantron commented 7 months ago

I haven't worked around the issues yet, but I'll just make sure that the Melange example is not built in most of the CI rows. I'll add a 5.1 row.