English · 00:21:58 Jan 21, 2026 8:13 AM
ClojureScript from First Principles — David Nolen
SUMMARY
David Nolen, at Clojure/NYC meetup, revives ClojureScript's foundational strengths as a lightweight alternative to bloated JavaScript tools, highlighting its standard library, efficient compilation, REPL interactivity, and potential for functional UI via DOM morphing.
STATEMENTS
- ClojureScript emerged around 2011 from Rich Hickey and the Clojure team, integrating deeply with Google Closure Compiler to produce compact, optimized JavaScript.
- Early JavaScript development in 2005-2006 relied on manual cross-browser hacks from sources like Douglas Crockford and PPK, without debugging tools or jQuery.
- Web applications have degraded since 2012, with pages growing larger and slower despite advances like TypeScript and better tooling.
- React started as a simple, declarative script tag in 2013 without dependencies, but modern usage involves massive ecosystems leading to bundle bloat.
- JavaScript's lack of a standard library forces developers to add large dependencies for basic tasks like date arithmetic or email validation.
- ClojureScript provides a rich standard library of Clojure functions plus Google Closure Library utilities, enabling small payloads through dead code elimination.
- The REPL in ClojureScript supports hot reloading of namespaces and conversational queries for documentation, including Google Closure namespaces.
- Advanced compilation with Google Closure Compiler processes 7MB of code in 1.5 seconds, outputting just 3K for unused libraries.
- ClojureScript's tree-shaking precision remains unmatched by standard JavaScript tools, addressing persistent web performance issues.
- The JavaScript community faces major pain points in dependency management and build tools, problems ClojureScript solves natively.
- Revisiting ClojureScript's first principles offers alternatives to React-heavy development, avoiding ecosystem churn and promoting simpler tooling.
IDEAS
- ClojureScript functions like a modern jQuery by simplifying cross-browser interactivity without the baggage of npm dependencies.
- Firebug marked the end of JavaScript's dark ages, but ClojureScript's 2011 release brought Lisp power to web development seamlessly.
- Despite React's popularity, its ecosystem has turned a once-simple declarative approach into a dependency nightmare.
- Blog posts on JavaScript optimization reveal exhaustive manual tweaks, like rewriting imports, highlighting tooling as a "chocolate factory of foot guns."
- ClojureScript hobbyists at the New York Times in 2011 saw it as a bridge from Clojure libraries to interactive web apps.
- Semantic reloading in Lisp-based REPLs treats code changes as fundamental program updates, not just a dev tool gimmick.
- Including the full Clojure standard library generates 50K lines of JS, yet unused parts vanish, yielding tiny outputs like 3.7K for a Minecraft demo port.
- Localization for dates, such as German formatting, compiles efficiently without manual plugin composition required in libraries like Day.js.
- DOM morphing, inspired by HTMX and projects like Datastar, enables restful apps with seamless SPA experiences via functional updates.
- ClojureScript's bias-free approach avoids JavaScript's cargo-cult practices, positioning it to learn from React without inheriting its complexities.
INSIGHTS
- ClojureScript's built-in standard library and compiler eliminate the need for bloat-prone npm packages, fostering leaner web apps amid rising JS fatigue.
- Advanced tree-shaking in Google Closure Compiler achieves precision dead code elimination that modern JS bundlers still struggle to match, reversing web bloat trends.
- The REPL's conversational nature embodies Lisp's interactive essence, turning development into a fluid dialogue with code and docs.
- React's original declarative simplicity has been lost to ecosystem overload, but ClojureScript preserves a path to functional UI without the churn.
- Native DOM morphing could integrate restful server-rendered HTML into ClojureScript, blending traditional and SPA benefits for lighter tooling.
- Embracing first-principles features like hot reloading and library utilities counters JavaScript's declining software quality by prioritizing efficiency over hype.
QUOTES
- "CLJS is a damn good jQuery."
- "This is the graph of like web pages getting bigger and bigger and bigger and bigger and slower."
- "Why isn't the quality of software improving? You know, there seems to be a sort of negative inverse correlation."
- "There's no simple fix to this problem. There's no simple thing you can do."
- "Reloading is a sort of fundamental idea. It's a fundamental idea. You can reload programs."
HABITS
- Start projects with a minimal deps.edn file defining dependencies and simple build scripts, similar to package.json.
- Use the REPL for interactive experimentation, querying docstrings and signatures directly in the browser.
- Implement hot reloading by recompiling specific namespaces during development to avoid full page refreshes.
- Regularly compile to advanced release mode to check output size and ensure dead code elimination.
- Integrate Google Closure Library functions for tasks like string trimming or date localization without external deps.
FACTS
- ClojureScript compilation of 7MB JavaScript now takes 1.5 seconds on modern hardware, down from 40 seconds in 2010 demos.
- A port of Notch's Minecraft canvas demo using ClojureScript macros outputs just 3.7K of JavaScript despite including the full standard library.
- The JavaScript 2024 survey ranks dependency management as the third biggest pain point and build tools as fourth.
- Web page sizes have increased steadily since 2012, degrading user experience in 2025 despite tooling advances.
- Google Closure Compiler's tree-shaking algorithm remains superior, producing payloads like 5K for localized date arithmetic versus 40K for Moment.js.
REFERENCES
- Douglas Crockford's posts on JavaScript mechanics.
- PPK's cross-browser compatibility resources.
- Firebug extension for Firefox debugging.
- Rich Hickey and Clojure team's ClojureScript release.
- React framework (initial 2013 script tag version).
- Google Closure Compiler and Library.
HOW TO APPLY
- Create a deps.edn file with ClojureScript as a dependency and define :dev and :release build aliases for compilation.
- Launch a browser-connected REPL using tools like Clojure Tools CLI to enable interactive code evaluation and hot reloading.
- Write core namespace functions, such as console logging or date operations, and require Google Closure namespaces as needed.
- Edit and reload specific namespaces in the REPL to test changes without browser refresh, observing immediate updates.
- Compile the project to advanced mode, measure the output size, and adjust to minimize unused code for optimal payloads.
ONE-SENTENCE TAKEAWAY
Revisit ClojureScript's core features to build lightweight, efficient web apps free from JavaScript's dependency and tooling woes.
RECOMMENDATIONS
- Explore ClojureScript's REPL for conversational development to accelerate prototyping and reduce documentation hunts.
- Leverage Google Closure Library for built-in utilities like email validation and internationalization, skipping npm bloat.
- Adopt advanced compilation routinely to harness superior tree-shaking and achieve sub-10K payloads for simple apps.
- Integrate DOM morphing natively to enable functional, restful UIs with seamless updates and preserved state.
- Aggregate and publicize ClojureScript docs for browser APIs and UI components to boost community awareness and adoption.
MEMO
David Nolen stepped into the revived Clojure/NYC meetup after a six-year hiatus, his enthusiasm palpable as he championed ClojureScript's enduring relevance. In an era of ballooning web payloads—pages now routinely larger and slower than in 2012 despite promises of TypeScript and modern bundlers—Nolen argued that this Lisp dialect for JavaScript offers a return to first principles. Born in 2011 from Rich Hickey's vision, ClojureScript integrated seamlessly with Google Closure Compiler, a tool then obscure but prescient in its demand for tiny, tree-shaken artifacts. Nolen recalled his own pivot at The New York Times, trading JavaScript drudgery for Clojure's expressive power in interactive apps, a move that felt revolutionary amid the dark ages of Firebug and manual cross-browser hacks.
The talk's demo cut through the noise: a simple deps.edn file spun up a REPL-linked browser, where code edits triggered hot reloads without page refreshes—a Lisp fundamental often overshadowed by flashier tools like Shadow-CLJS. Nolen queried docstrings mid-session, pulling signatures for Google Closure's string utilities, underscoring ClojureScript's hidden depth. Compiling 7 megabytes of library-laden code yielded a mere 3 kilobytes, stripping unused functions with ruthless efficiency. For date arithmetic, a task that bloats JavaScript bundles via Moment.js or Day.js, ClojureScript delivered 5K of gzipped output, even localized to German formats, all without plugin gymnastics.
Yet Nolen didn't romanticize; ClojureScript shares JavaScript's pains when leaning on React, that once-svelte 2013 upstart now mired in dependency hell. Surveys confirm the churn: managing packages ranks as a top developer gripe, build tools not far behind. ClojureScript sidesteps this with its baked-in standard library—think email validators and autocompleters from Google Closure, predating npm's explosion by years. Nolen urged the community to revisit these primitives, warning that React hate misses the forest: it's the ecosystem, not the framework, eroding web quality.
Looking ahead, Nolen speculated on enhancements like full externs for browser APIs, allowing REPL queries for Web Crypto or Temporal without leaving the environment. He eyed DOM morphing, a React-inspired technique powering HTMX and 37signals' Turbo, as a game-changer for functional UIs in restful apps—seamless updates preserving scrolls and inputs, all without external cruft. At 14 years old, ClojureScript isn't chasing trends but offering an antidote to JavaScript malaise, from micro-modules to lodash's 72 million weekly downloads.
In closing, Nolen's plea resonated: ClojureScript's bias-free roots, early embrace of React, and potential for lighter tooling position it uniquely. As web development grapples with declining standards, this unassuming tool invites a rethink—build small, compile smart, and let the REPL converse. The applause suggested a spark reignited, promising fresh dialogue in New York's Clojure scene.
Like this? Create a free account to export to PDF and ePub, and send to Kindle.
Create a free account