Is it a recent trend to write JavaScript tools in other languages?

We’ve recently seen an increase in JavaScript tools written in languages other than JavaScript. This blog post gives a few examples and discusses why not using JavaScript is appealing.

JavaScript tools examples

We posed the question on Twitter, and the following are some of the responses:

Build compilers and tools:

  • esbuild – Go: It is a JavaScript bundler and minifier which encapsulates JavaScript and TypeScript code for web delivery.
  • Snowpack, Vite, and Hugo all use it.
  • swc – JavaScript/TypeScript compiler in Rust.
  • Google Closure Compiler – Java: Checker and Optimizer for JavaScript.

Linters and code formatters:

  • RSLint is a JavaScript linter written in Rust.
  • Flow is a static type checker for JavaScript written in OCaml.
  • dprint is a code formatting platform for Rust.

Using command-line utilities:

  • Fast Node Manager (fnm) is a Node.js version manager written in Rust.
  • Manage JavaScript command-line tools such as node, npm, and yarn with Volta – Rust.

Why other languages for JavaScript tools?

What are the advantages of not using JavaScript (or languages that compile to JavaScript)?

  • They can be compiled into native binaries, which run faster.
  • Native binaries are often usually much faster than JavaScript.
  • Parallelization is greatly simplified in many languages.

Additionally, several non-JavaScript languages can now be compiled to WebAssembly, resulting in binaries that are almost as portable as JavaScript – and fit well with it.

A non-JS language might also be better suited for a given mission, given that each language has its own specialties. For example, algebraic data types are supported by OCaml/ReasonML, Haskell, and other functional languages, which aid in the processing of data structures such as abstract syntax trees, which are used while parsing and/or compiling formal languages.

Advantages with JavaScript tools

There are other advantages of using JavaScript:

  • It’s easier to find tool contributors: On the one hand, programmers who are familiar with non-JS languages are less likely to work on JavaScript-related software. A non-JS language, on the other hand, is a significant barrier for JavaScript programmers.
  • You can “dog-food” a language tool by applying it to the tool’s code. As a result, working on the tool’s codebase allows you to better understand what you want from it.
  • With a language specification, extensive documentation, useful resources, and numerous libraries, JavaScript has a thriving ecosystem (via npm).
  • TypeScript isn’t as elegant as specialized languages for functional programming, but it’s similar enough without sacrificing the JavaScript ecosystem. Discriminated union types, for example, are somewhat more verbose than algebraic data types, but they have many of the same advantages (such as compile-time exhaustiveness checks).

AssemblyScript may be a good choice if speed is a priority: It’s a TypeScript version that’s compiled into WebAssembly.

The third age of JS

The trend of JS tools written in other languages

Stay Connected!

Are you looking for a JavaScript developer?

Book your FREE call with our technical consultant now.
Let's Build Your App

Book your FREE call with our technical consultant now.

Totally enjoyed working with Karan and his team on this project. They brought my project to life from just an idea. Already working with them on a second app development project.

They come highly recommended by me.

Owner, Digital Babies