news.volyx.in

Bonsai: Janestreet's UI Library (github.com)

390 points by KolmogorovComp · 24 days ago · 155 comments on HN

Article summary

Bonsai is a UI library developed by Jane Street for building performant, reactive web applications in OCaml. It allows for the composition of state and incrementality primitives and is used to build web applications within the company. Bonsai also enables the use of the same language and types on both the backend and frontend. The library includes features such as a powerful templating language and support for component-specific stylesheets.

Main themes

  • UI libraries
  • OCaml
  • Reactive web applications
  • Backend and frontend development
  • Type safety
  • Compilation speed

What commenters say

  • The development of new UI libraries like Bonsai is unnecessary due to the existence of AI-powered code generation tools.
  • Having a strict compiler and simple language can improve type safety and reduce errors, making frameworks like Bonsai valuable.
  • The use of a single language for both backend and frontend development can improve code maintainability and reduce errors.
  • The compilation speed and hot reload capabilities of a framework are crucial factors to consider, and some frameworks may not be suitable for large-scale applications.
  • The use of WebAssembly (WASM) can solve some of the problems associated with integrating frontend code written in a backend language with the rest of the JavaScript ecosystem.
  • Some commenters believe that Bonsai's approach is not new and that similar attempts have been made in the past with other languages, such as Scala and Clojure.
  • Others argue that the benefits of using a framework like Bonsai, including improved type safety and maintainability, outweigh the potential drawbacks.
  • The choice of framework ultimately depends on the specific needs and goals of the project, and what works for one company or project may not work for another.