rescript-lang / syntax

ReScript's syntax as a standalone repo.
MIT License
256 stars 38 forks source link

Compilation with OCaml 5.0 #725

Closed LimitEpsilon closed 1 year ago

LimitEpsilon commented 1 year ago

Hi, with the release of OCaml 5.0, I have recently been trying out compilation of various codebases with 5.0. However, since the file compiler-libs-406/obj.ml referenced primitives that are deprecated in 5.0, the code did not compile.

Therefore, I simply copied-and-pasted files from ~/.opam/5.0.0/lib/ocaml over to compiler-libs-406 and fixed some details. As a result, compilation works for both OCaml 4.14.1 and 5.0. Link to code

Running testrunner on the newly compiled binary seems to be ok, but since I changed a considerable amount of code, I am cautious about suggesting this change. Would opening a PR be fine?

mununki commented 1 year ago

There is another ongoing task to experiment to compile with OCaml 5 by @cknitt https://github.com/rescript-lang/rescript-compiler/pull/5895 Maybe worth referring to his work.

cknitt commented 1 year ago

Hi @LimitEpsilon, thanks for your efforts!

Note that the syntax repo is deprecated which unfortunately isn't mentioned in the README yet. The syntax was merged directly into the compiler repo some time ago. It can now be found at https://github.com/rescript-lang/rescript-compiler/tree/master/res_syntax and uses the compiler libs from https://github.com/rescript-lang/rescript-compiler/tree/master/jscomp/ml.

On the current master of the compiler repo, everything already builds fine with OCaml 5.0.

LimitEpsilon commented 1 year ago

Oh, that's great to hear! Thanks for the reply!

cknitt commented 1 year ago

On the current master of the compiler repo, everything already builds fine with OCaml 5.0.

(With some dependency upgrades like in my above mentioned PR.)