I don’t know what’s wrong with compile to Js languages, but every time I want to give them a try they are always in the middle of a major rewrite/rebrand/overhaul with breaking changes and incompatible stuff that renders all that I know and all the documentation that I have bookmarked useless. This leads me to the frustrating situation where I spend more time making the toolchain work and looking for the proper resources rather than writing my domain code. This happened to me with Purescript 0.12, elm 0.18 and now with Bucklescript.
Right now I was building a small project in Google Apps script, and I wanted to have some functional practice so I decided to write some utils in ocaml. To my surprise I was redirected to some unfamiliar rescript page.
I just want to write some .ml files, import them on my main file and compile them using parcel. I will probably need to write some JS interop and leverage some existing tooling, but I have not idea to where should I look at. Bucklescript docs are gone (or that is what the very insistent redirects make me think) and existing docs for the tools I use are out of date.
For example, if I follow parcel docs for Reason and I try to compile I get this annoying error:
✦ ➜ parcel build Código.js
🚨 /Users/danielo/mega/programacion/node/ElectronicProjectsSpreadsheet/src/Util.ml:
bs-platform version mismatch Running bsb 4.0.18 (/Users/danielo/.config/yarn/global/node_modules/bs-platform)
vs vendored 8.2.0 (/Users/danielo/mega/programacion/node/ElectronicProjectsSpreadsheet/node_modules/bs-platform)
So my questions are: where do I look for javascript docs in Ocaml syntax and how do I make my very simple setup (just parcel and some ml files) work again?
Ok, I solved one problem by upgrading the installed version of bsb-platform (the global one) to the latest.
Also, I find that Tablecloth has a switch for using Ocaml syntax (thanks god). However I still don’t know where to look for docs on ocaml bucklescript for js interop
My best guess is that the new site https://rescript-lang.org/ is probably a rebrand of the previous BuckleScript site, but with OCaml references and code samples removed. I too used to refer to the documentation often, and feel lost without it. Those @bs.* decorators look very different in ReScript’s FFI syntax.
Maybe an OCaml-specific cheat sheet is in the works though.
Oh for sure, there’s been strong reassurances that OCaml support in BuckleScript/ReScript was here to stay in the long term, which is why I am keeping it as my platform for developing stand-alone client-side components. My current issue is with the disappearance of OCaml-syntax documentation for the various features which the compiler adds to vanilla OCaml (the PPX-like decorators in particular).
I am very disappointed with the state of Bucklescript/ReScript. Sure, OCaml is technically supported, but the removal of OCaml documentation does not inspire confidence.
Thanks buddy, I’ll take a look.
I think they removed the old site to early. Knowing the current rescript state is “Beta” removing all the documentation many people may need shows very little respect for the community
Seriously, this is daunting.
I was trying to use Tablecloth as standard library because it looked nice, and the docs are way ahead of the published version, and of course it is not compatible with the latest bucklescript. What a nightmare
You are welcome to drop by the #rescript channel of the ReasonML Discord, we answer a lot of questions there. I’m sure lots of people would be happy to help debug.
Thanks for the suggestion @yawaramin
I just took advantage of my memory to:
Remember that TableCloth main features I wanted to use were coming from reason-standard (a library that I read about almost by accident)
Dig into reason-standard and use the very same bsb version
Delete a lot of caches, global installs and stuff
After all that I managed it to compile. Not the worst onboarding, but I had a lot of luck to make everything work.
I’m just sharing my experience so we have another view from an outsider and maybe some other newbies can take info from it.
Thanks
Thanks Danielo. Onboarding impressions would probably be best to put in the ReScript Discourse, which is checked by the team. I’m guessing they don’t really check the OCaml Discourse for ReScript/BuckleScript feedback.
True, but this has just “derived” from the original topic that was about what is the Ocaml new way of doing frontend. But now that seems that it is still BuckleScript I think it is better to add this feedback there too.
The problem that I see with those tools are that, bucklescript generates more readable code that I can debug if I need to and seems to have better performance. Also, bucklescript it’s supported by the major Javascript bundles like webpack and parcel, and to use dune I will probably require many extra setup steps.
I don’t like how the team behind bucklescript is doing things, but I have to admit that the tool is easy to use and has a great performance.
But thanks for providing me with an alternative