GoLang backend for ReScript?

How difficult would it be to swap ReScript’s JS backend for a GoLang backend ?

For server side, I can do the basics via ReScript → JS, and then run on NodeJS (with some FFI work).

If possible, I’d prefer to use the GoLang runtime instead of NodeJS.

What I don’t like about GoLang is the lack of sun/union types. What I do like about GoLang over NodeJS is (1) multi thread and (2) libraries.

Thus, I’m curious: how big/complex is the ReScript JS-code-emitter, and how difficult it would be to target GoLang instead of JS.

Thanks!

1 Like

Interesting question. The reason we have things like Rescript that compiles to JS is because that’s the only thing browsers understand, but on the backend you don’t have that limitation. If Node is too slow, why not explore using something like Ocaml or F# instead?

4 Likes

I think GoLang just beats everything at libraries. For example: Pion, Litestream.

Interesting question. People have also talked about things like this regarding OCaml/Reason. Here’s a sampling:

Obviously, these are about OCaml, but, I think you will find them to be interesting reading.

2 Likes

I had a similar question and ran across this Ocaml to Go attempt a while ago. Looks like it was dropped but interesting effort

1 Like

Interesting, perhaps I should mention that I mentioned ReHP as well in the OCaml Discuss: Compiling subset of OCaml to GoLang / Julia? - #10 by yawaramin - Learning - OCaml

@zeroexcuses since you are posting the same question in two related forums it would be good if you could link them so that people could track answers in both places.

3 Likes

Good call, will do in the future.