Hasty Briefsbeta

Bilingual

ReScript 12 (2025)

11 hours ago
  • ReScript 12 features a new build system, standalone runtime, unified operators, JSX preserve mode, and syntax improvements.
  • The new build system improves dependency tracking and reduces recompilations, integrating with monorepo workflows.
  • The standard library @rescript/core is now included as 'Stdlib', with many additions to reduce utility code.
  • Unified operators (+, -, *, /, %, **) work for int, float, and bigint, eliminating the need for separate float operators.
  • New F#-style bitwise operators (&&&, |||, ^^^, ~~~) are supported, with legacy OCaml ones deprecated.
  • Dict literals and pattern matching are introduced, compiling to plain JavaScript objects and enabling concise JSON destructuring.
  • Nested record types, variant pattern spreads, and experimental let? syntax for zero-cost unwrapping are added.
  • JSX preserve mode emits JSX syntax directly for compatibility with bundlers like ESBuild or Babel.
  • Function-level @directive attribute emits JavaScript directives (e.g., 'use server') for server actions and frameworks.
  • JavaScript regex literals are now supported, replacing %re expressions with clearer syntax.
  • Breaking changes include a new build system, runtime package split, API naming alignment (Exn to OrThrow), and JSX v3 removal.
  • OCaml compatibility helpers (e.g., succ, pred, |>) are deprecated in favor of JavaScript-aligned alternatives.
  • Platform improvements include ESM-first distribution and platform-specific binaries for faster installs.