Skip to main content

Richard Feldman on Roc: A Fast, Friendly, Functional Programming Language

ChangelogJune 11, 20251h 28min4,689 views
59 connections·40 entities in this video→

Roc: A Descendant of Elm

  • πŸ’‘ Roc is a programming language directly inspired by and descended from Elm, aiming to provide a similar ergonomic and friendly developer experience.
  • πŸš€ While Elm focuses on front-end web development, Roc is designed for a broader range of domains, including servers, command-line apps, native GUI apps, and even esoteric applications like programming physical devices.
  • 🎯 A core value inherited from Elm is a focus on compiler ergonomics and friendly error messages, aiming to make the development process as smooth as possible.

Language Design and Features

  • 🧩 Roc has evolved significantly from Elm, adopting a more mainstream syntax that visually resembles languages like TypeScript, which can lower the barrier to entry for new developers.
  • ⚑ Static dispatch is a key feature, enabling a simpler underlying mechanism for function calls compared to object-oriented languages, while still allowing for familiar syntax like method-style calls.
  • πŸ› οΈ This simple dispatch mechanism unlocks powerful features like custom equality and operator overloading by simply implementing named functions within a module, without complex trait systems.
  • 🧠 The language emphasizes immutability and pure functions, with a unique purity inference system that uses thin arrows (->) for pure functions and thick arrows (=>) for effectful functions, enforced by the compiler.

Performance and Safety

  • πŸš€ Roc aims for extremely fast compiler performance, with the new compiler rewrite targeting speeds significantly faster than the old one, aiming for millions of lines of code per second parsing.
  • πŸ“ˆ While not aiming for the absolute peak performance of languages like Rust or C++, Roc targets runtime performance competitive with or exceeding Go, especially in its memory management and use of LLVM for optimizations.
  • πŸ”’ Roc offers strong safety guarantees, particularly for trusting third-party code, and its platform concept allows for sandboxing scripts to prevent malicious actions.
  • 🀝 The language avoids a heavy runtime or virtual machine, compiling down to efficient code similar to Rust's ARC, offering a garbage-collected feel without GC pauses.

Error Handling and Development Experience

  • βœ… Roc handles the absence of null or maybe types by using a Result type (similar to Rust's) for operations that can fail, combined with powerful anonymous sum types.
  • πŸ’‘ This allows for expressive error modeling where functions can return a union of all possible error types, which the compiler exhaustively checks, ensuring all potential failures are handled.
  • πŸ’¬ The compiler follows a philosophy of "inform but don't block," providing warnings and errors but generally allowing programs to run even with some compile-time issues, facilitating a more flexible development workflow.
  • πŸ“¦ Dependency management is URL-based with content hashes for security, and dependencies are cached globally, simplifying scripting and avoiding large local node_modules-like directories.

Downsides and Future

  • ⚠️ Current downsides include the immaturity of the compiler and known bugs in areas like unboxed closures, with a major rewrite underway targeting a 0.1.0 release in 2026.
  • πŸ“š While Roc has a growing community, it's still a niche language, meaning a learning curve and fewer readily available libraries compared to more established languages.
  • βš™οΈ The language intentionally omits first-class mutation for simplicity, which can make certain algorithms less ergonomic to write compared to languages with more imperative features.
  • 🌐 The distribution story is robust, supporting compilation to binaries, dynamic libraries, and WebAssembly, with plans for more sophisticated versioning.
Knowledge graph40 entities Β· 59 connections

How they connect

An interactive map of every person, idea, and reference from this conversation. Hover to trace connections, click to explore.

Hover Β· drag to explore
40 entities
Chapters19 moments

Key Moments

Transcript331 segments

Full Transcript

Topics15 themes

What’s Discussed

Roc programming languageElm programming languageFunctional programmingCompiler designStatic dispatchOperator overloadingPurity inferenceAutomatic Reference Counting (ARC)Result typeAlgebraic data typesAnonymous sum typesWebAssemblyCommand-line applicationsServer-side developmentDependency management
Smart Objects40 Β· 59 links
MediasΒ· 8
PeopleΒ· 3
ConceptsΒ· 15
ProductsΒ· 7
CompaniesΒ· 6
EventΒ· 1