Nov 17, 2020

Editor Support, Custom Operators and More

Update on what we're doing around the end of 2020 and early next year.

Maxim Valcke
Syntax Lead

Upcoming Improvements

As we're approaching the end of 2020, we'd like to inform our community of our remaining tasks for the year and early next year.

Editor Integration

In the coming days, Cristiano and Cheng Lou will finally be ready to unveil the new VSCode ReScript experience, including diagnosis, autocompletion, jump to definition and type hints!

Patrick and Maxim will also help polishing the same feature set for Vim and Sublime Text.

Compiler & Build

Hongbo continues to improve the compiler experience in monorepo-like setups. Expect your build to keep getting faster and more robust!


Patrick is rearranging the React documentation, and continues to improve the main documentation site with Cheng Lou.


Custom Operators

The team had a few discussions surrounding the issue of the new syntax disallowing custom infix operators. Two of our values collided here:

  • We'd like our community to focus on product discussions rather than FP idiosyncrasies, given that it is a common issue that the shiny corners of FP suck the air out of discussions. Many FP and OOP communities (the latter with their own noisy design pattern bickering) have seen the same pattern played over and over, and we'd like to avoid it. This was one of the primary motivations for the new ReScript syntax to disallow custom infix operators.

  • However, we also care about supporting our existing users, and providing a smooth transition path toward newer code, as we've shown over the years. Alas, it is a fact of life that many existing codebase on the older syntax use custom infix operators.

After much debates, we've decided to re-enable the ability for users to define their infix operators, the same way they did in the old syntax. Note that this is only meant to provide a good upgrade path; we do not encourage the usages of infix operators and we hope that the community is responsible enough using them.

Simpler Interop

We're considering a lightweight, familiar syntax sugar for @bs.module for binding to JS code:

@js import { dirname: string => string, relative: (~from: string, ~to: string) => string } from "path"

(Just a prototype syntax. Not set in stone.)

This will mix well with the other existing external features that aren't about importing a module, such as bs.send.

We will consider providing an automatic translation of your current @bs.module externals into the new format, so you can keep writing your bindings right now while expecting a potentially nice upgrade when the time comes.

Hopefully this encourages more usages of zero-cost JavaScript interop! We value this very much.

React 17

Last but not least, there are some updates to JSX coming.

Although React 17 doesn't ship with any new features, there is a new JSX transform. The new JSX improves bundle size, reduces the number of concepts you need to learn in React and improves the performance.

ReScript will be the first to adopt the new JSX spec, which we've deemed to be solid enough. Our own Ricky has had a hand in drafting it.

It goes without saying that this will also have an upgrade path.

Wrapping Up

2020 has been rather weird; hopefully these end-of-year changes brighten you up a bit!

Stay safe and keep shipping products!

Want to read more?
Back to Overview