Hacker News new | ask | show | jobs
by marcus_cemes 1355 days ago
I don't understand why ReScript is trying to sell itself as a language for React. React is already "kind of" functional, has a rich JS/TS ecosystem and there are fantastic alternatives such as Elm.

I think this would have huge potential in the backend space if it had good interop with Node.js and TS, with perhaps a functional framework similar to Elixir's Phoenix. Elixir proved it can have fantastic integration with Erlang.

* More robust applications with the Result type

* An actual integer type (for 64-bit database keys, Prisma uses BigInt)

* Finite state machines for stateful logic, games, websockets (enums and a sound type system)

* Benefit from the JS-centric serverless ecosystem

We've already been "compiling" or "transpiling" JS for years, most of written JS code has little in common with what is actually run.

In its current state, I don't even want to imagine what it would be like to set this up alongside ESM, TS, Prettier, ESLint, Jest, Storybook, ESBuild, Vite, (insert cool tool here). I've already spent literal days trying to setup a "modern" Node.js project, only to give up and go back to CJS for simplicity and import older non-ESM versions of packages[1], wish I wasn't using Node.js, then remember how many things I miss from JS when trialing another language.

[1]: https://github.com/ai/nanoid/issues/365

4 comments

JS ecosystem is really a joke, you need to put too much work on configuring, maintaining the tooling, just to write a "modern" JS project you need to setup a bundler, linter, test, etc. I think Vite with Vitest is going in the right direction, so you have just one tool, not a lot of tools, just check how hard is to test your code with jest (maybe there's a better library, it was at least from my knowledge widely used), you need to configure almost a separate building pipeline so your code can use ESM and typescript, or you also need to install ts-jest.

Deno also has an interesting approach (you have all the tooling officially shipped like Rust does), but sadly most of the official libraries will not work or does not work with it (maybe I'm wrong and there's a work about), but also I think that not having a manifest with your dependencies makes all harder (will import maps be a thing soon enough? is up to the task?).

Also there is rome.tools, but seems far from being usable yet, besides the formatter.

The BEAM VM, the virtual machine which runs Erlang and Elixir, is very opinionated. It provides primitives which every language must support. The primitives require the languages to be functional. I don't see how ReScript and Node can have such tight interoperability having the differences in the languages.
no dev is going to be famous for porting immutablejs to elixir.
ReScript was advertised to be a great language for powering up React in the years of ReasonML. It may be opinionated, but people grew interest in ReScript along with React.
Can you share what do you miss from JS when trialing another language?