English · 00:04:18
Jan 21, 2026 8:13 AM

New ClojureScript features in the 1.12.116 release

SUMMARY

An unnamed reviewer demonstrates key enhancements in ClojureScript 1.12.116, including ES6 support, CLJS proxy for efficient interop, refer global for script tags, and light mode for smaller builds.

STATEMENTS

  • ClojureScript 1.12.116 represents a major feature release incorporating significant enhancements to the compiler and library.
  • The Google Closure compiler has been updated, utilizing a forked version of the Google Closure library maintained by the team and community.
  • ClojureScript now defaults to ES6 output after nine years of availability, improving performance and enabling new language features.
  • CLJS proxy provides an experimental namespace that lazily converts ClojureScript maps and vectors into JavaScript objects and array-likes with minimal overhead.
  • Refer global and require global allow importing JavaScript globals from script tags without needing JS/ prefixes or additional build configuration.
  • Light mode compiler flag replaces ClojureScript data structures with native ones, while elide-tostrings removes unnecessary string implementations to reduce build sizes by up to two-thirds.

IDEAS

  • Shifting to ES6 in ClojureScript leverages a decade-old standard for substantial performance gains, highlighting how mature web technologies can refresh older ecosystems.
  • CLJS proxy acts as a clever, low-overhead bridge between immutable ClojureScript structures and mutable JavaScript expectations, revolutionizing interop without full conversions.
  • David Nolan's implementation of CLJS proxy ensures laziness in bridging, preventing unnecessary computations until JavaScript access occurs.
  • JSON.stringify seamlessly processes proxied ClojureScript maps as native objects, simplifying data serialization for web transmission.
  • Supporting Closure method values in maps, like String.toUpperCase or Object.new, integrates advanced JavaScript functions directly into ClojureScript without awkward wrappers.
  • Refer global treats script-tag-loaded libraries as first-class requires, enabling minimal builds that favor external scripts over bundling everything.
  • Light mode swaps ClojureScript's custom data structures for JavaScript natives, drastically cutting artifact sizes for projects not needing EDN recursion.
  • Elide-tostrings flag eliminates dual string implementations, targeting programs that avoid recursive EDN printing to achieve even tinier outputs.
  • A simple console.log in ClojureScript compiles to just 2.5K uncompressed and 1K gzipped, showcasing the compiler's efficiency for micro-apps.
  • Adding native data structures balloons build size from 2.5K to 86K, but light mode reins it back to 26K uncompressed and 6.6K gzipped.

INSIGHTS

  • Adopting ES6 in legacy systems like ClojureScript demonstrates that waiting for technological maturity can yield outsized performance benefits without rushed implementations.
  • Lazy interop via proxies reveals a deeper harmony between functional immutability and imperative JavaScript, reducing friction in hybrid codebases.
  • Global referencing without build tweaks empowers developers to mix third-party scripts fluidly, prioritizing simplicity over monolithic bundling in modern web development.
  • Compiler flags like light mode underscore how targeted exclusions of unused features can transform bloated artifacts into lean, deployable code.
  • The dramatic size reductions from eliding strings highlight the hidden costs of generality in languages, where specialized flags unlock efficiency for niche use cases.
  • Experimental features like CLJS proxy signal evolving compiler designs that anticipate developer pain points, fostering ecosystems where ClojureScript feels more native to JavaScript environments.

QUOTES

  • "CLJS proxy is a new experimental namespace that lazily bridges closure script maps and vectors into JavaScript."
  • "JavaScript code can now see closure script maps as objects and vectors as array likes."
  • "With refer global, you can now import these JavaScript globals and it'll treat them as if they were required like any other library."
  • "Light mode is a new compiler flag that basically lets you make smaller closure script builds by swapping out the closure script data structures for the original data structures."
  • "You can cut your initial artifact size by 2/3 if you use these flags."

FACTS

  • ES6 has been available for nine years, prompting ClojureScript's shift for better performance and features.
  • A basic console.log ClojureScript program compiles to 2.5K uncompressed and 1K gzipped with advanced optimizations.
  • Introducing a native ClojureScript vector increases build size to 86K uncompressed and 19K gzipped without light mode.
  • Light mode with elide-tostrings reduces a data structure-using program to 26K uncompressed and 6.6K gzipped.
  • ClojureScript maintains its own fork of the Google Closure library, actively updated by the Closure team and community.

REFERENCES

  • Google Closure compiler and library fork.
  • David Nolan (implementer of CLJS proxy).
  • ES6 standard.
  • JSON.stringify function.
  • String.toUpperCase and Object.new methods.

HOW TO APPLY

  • Install the latest ClojureScript version 1.12.116 along with dependencies like Clojure, Java, and RLWrap to enable new features.
  • Require the builder function from cljs.proxy namespace in your ClojureScript code to start using proxies for data bridging.
  • Create a ClojureScript hashmap, wrap it with the proxy function, and access it via dot notation to treat it as a JavaScript object.
  • Use refer-global in your namespace declaration to import JavaScript globals from HTML script tags without JS/ prefixes.
  • Set the :light-mode and :elide-tostrings compiler flags to true during advanced compilation to minimize build sizes with native structures.

ONE-SENTENCE TAKEAWAY

ClojureScript 1.12.116's new features enhance JavaScript interop and reduce build sizes for more efficient web development.

RECOMMENDATIONS

  • Upgrade to ClojureScript 1.12.116 immediately to access ES6 performance boosts and streamlined interop.
  • Experiment with CLJS proxy for any project involving JSON serialization or JavaScript library integration to cut conversion overhead.
  • Incorporate refer-global for workflows relying on external script tags, simplifying minimalistic build setups.
  • Enable light mode and elide-tostrings in production builds to achieve up to two-thirds size reductions without sacrificing core functionality.
  • Test build sizes with and without native data structures to identify opportunities for compiler flag optimizations in your apps.

MEMO

In the ever-evolving landscape of JavaScript development, ClojureScript's latest release, version 1.12.116, arrives as a beacon of refinement. This major update, detailed in a brisk four-minute walkthrough by an enthusiastic reviewer, integrates the venerable ES6 standard after nearly a decade of maturity. The shift promises not just speedier execution but also unlocks a suite of enhancements that bridge the gap between Clojure's functional purity and JavaScript's pragmatic imperatives. For developers weary of clunky interop, this feels like a quiet revolution.

At the heart of the release lies CLJS proxy, an experimental gem crafted by David Nolan. This namespace lazily transforms ClojureScript's immutable maps and vectors into JavaScript-friendly objects and array-likes, all with negligible overhead. Imagine wrapping a simple hashmap—say, one holding a name like "Alice" and an age—and watching it behave seamlessly under JSON.stringify or dot-notation lookups. Mutations? They fizzle against the underlying immutability, preserving Clojure's ethos while fooling JavaScript into complacency. The reviewer demonstrates this live in Node, printing the proxy to reveal its deceptive normalcy, a testament to how subtle engineering can erase longstanding inefficiencies in data handoffs.

Further streamlining comes via refer-global and require-global, which elegantly hoist JavaScript globals from HTML script tags into ClojureScript namespaces. No more pesky JS/ prefixes or convoluted build configs; these tools treat external libraries as equals to required modules. It's a boon for those favoring lightweight setups over heavy bundlers, allowing script tags to inject functionality without ceremony. The reviewer nods to its appeal for minimalists, underscoring a broader trend toward modular, unbundled web apps.

Perhaps the most tantalizing addition is light mode, paired with the elide-tostrings flag, which slashes initial artifact sizes by two-thirds. By substituting ClojureScript's bespoke data structures with JavaScript natives and ditching redundant string printers—unneeded for most apps sans recursive EDN—this duo crafts remarkably compact outputs. A trivial console.log compiles to a mere 2.5 kilobytes uncompressed, or 1K gzipped; introduce a vector, and it balloons to 86K without flags. Activate light mode, however, and it shrinks back to 26K uncompressed, 6.6K compressed—ideal for embedded or mobile contexts where every byte counts.

ClojureScript's maintainers, through their forked Google Closure library, continue to nurture this ecosystem with care. This release doesn't overhaul paradigms but polishes edges, making the language more viable in JavaScript's shadow. For builders of web tools or libraries, it's a prompt to revisit builds: proxy for interop woes, globals for simplicity, light mode for leanness. In an era of bloated frameworks, such targeted innovations remind us that progress often hides in the details.

Like this? Create a free account to export to PDF and ePub, and send to Kindle.

Create a free account