top | item 46982943

Hologram v0.7.0: Milestone release for Elixir-to-JavaScript porting initiative

107 points| bartblast | 19 days ago |hologram.page

Creator here. Hologram compiles Elixir to JavaScript to run in the browser, enabling full-stack development in pure Elixir - and soon, Local-First applications.

This release is a milestone for our porting initiative. 49 contributors ported 150 Erlang functions across 19 modules, pushing client-side Erlang runtime coverage from 34% to 96% and overall Elixir standard library readiness from 74% to 87%.

This means the vast majority of Elixir standard library functions needed for full-stack web and basic local-first apps now work in the browser - string processing, collections, sets, binary operations, Unicode normalization, math, time operations, file path handling, and more.

Beyond porting, the release includes enhancements, bug fixes, and infrastructure groundwork.

Happy to answer any questions!

29 comments

order

knubie|19 days ago

This looks really cool. Congratulations on the milestone.

Does the elixir->js compiler exist as a separate project, or is it built into the framework? Is it based on an existing transpiler? How does it compare / contrast to something like gleam (which, AFAIU also let's you transpile elixir to JS)?

bartblast|19 days ago

Thank you! The Elixir -> JS compiler is currently coupled with the framework - it's a custom thing, not a separate dependency.

Re the Gleam comparison: I don't know Gleam's implementation in detail so someone correct me if I'm wrong, but as I understand it - Gleam compiles to fairly readable JS with a minimal prelude, and deliberately treats the two targets as having different concurrency semantics. It doesn't try to replicate BEAM processes or OTP in JavaScript, instead using JS's native promise-based async. The upside is zero runtime overhead and clean JS interop.

Hologram takes the opposite approach - we're iteratively reimplementing the Erlang runtime in the browser, with the goal of having full semantic parity eventually. The tradeoff is a heavier runtime, but the benefit is that the same Elixir code can run on both server and client with consistent behavior.

lawn|19 days ago

I may be wrong but I believe the elixir->js compiler is currently built into the framework but it could potentially be separated in the future.

Gleam is different in that JS is a first-class target and built into Gleam's compiler, while Hologram is a standalone project.

lawn|19 days ago

Hologram is an amazing project and I'm really excited for it's future.

I worked on a project last year based on Hologram but ran into some minor issues, and other real-life stuff got into the way. I'm looking forward to picking it up again soon as I have some energy to spare.

bartblast|19 days ago

Really appreciate it! Would love for you to give it another go - a lot has improved since then. If you run into any issues or have ideas for how things could be better, don't hesitate to reach out. Happy to help!

troupo|18 days ago

I keep keeping an eye on your amazing project. Though I've only touched it very superficially [1], I'm very keen to see where it goes (and want to use it finally one of these day)

[1] Being very lazy I immediately gave up of course, but did file a suggestion :) https://github.com/bartblast/hologram/issues/228

bartblast|18 days ago

Oh yeah, I remember! We'll get there :) Hope you'll give Hologram another spin sometime soon!

ZiiS|19 days ago

As a novice who enjoyed an AoC in Elixir but has never used it in battle; what is the quick answer to why JavaScript not WASM?

bartblast|19 days ago

Two big reasons: bundle size - few hundred KB uncompressed vs multiple MB already compressed with WASM. And the DOM lives in the JS world - WASM can't touch it directly and has to cross the JS bridge with serialization overhead every time.

On top of that, since the browser platform has different characteristics, you can surgically drop down to native JS functions instead of compiling and bundling everything. For example, things like Unicode code point databases are already built into the browser - no need to ship them in your bundle when you can just call into the native APIs. The compiled output is also readable which helps with debugging.

For web apps generally JS is the better target IMO - you want the smallest possible bundle and the app reacting as quickly as possible on load.

haolez|19 days ago

Slightly off-topic, but are there teams using Erlang instead of Elixir for application development?

I'm planning on getting into this ecosystem and I'm considering if it's worth it also becoming an expert on Erlang beyond understanding OTP's internals.

xlii|19 days ago

For serious apps it's impossible to escape reading Erlang or Erlang documentation. Many functions and libraries simply aren't available for Elixir or are partial (see `opentelemetry_*` family as an example). Deep debugging is almost exclusively done with Erlang functions.

I'd even say that the more serious/critical application becomes the more weight shifts toward Erlang. Personally I'd go with Erlang-first, but only because I've accumulated thousands paper cuts from Elixir.

For starters Elixir has much more palatable syntax, though.

bartblast|19 days ago

It depends on what you're doing. I've been in Elixir web dev for about 7 years and never really needed to write or understand Erlang, outside of my work on Hologram. That said, Erlang is always there under the surface - it "leaks" into Elixir in places if you look at the stdlib, and understanding it gives you a better mental model of the whole platform. I'd say you don't need it on a daily basis for most Elixir work, but the runtime and OTP are incredible pieces of engineering, and getting to know Erlang better will only make you stronger in this ecosystem.

GCUMstlyHarmls|19 days ago

It's very easy to call Erlang from Elixir,

    value = :erlang.function(a, b, c)

So with that in mind, you can just learn Elixir, use Erlang where you need it for some libraries. Elixir is IMO much nicer to learn, write and use. I think it is worth learning a bit about the underlying systems but I've never felt like I should have put in 10 erlang-only projects before writing larger elixir stuff.

abrookewood|19 days ago

Is the main benefit that someone who is familiar with Elixir can code the front-end in the same language? Or is the intention to have the front-end JavaScript act as a node in a cluster with the server?

bartblast|19 days ago

Both! Right now the focus is on enabling rich UIs with pure Elixir running in the browser. But eventually Hologram could be able to act as an Erlang node in the cluster as well.

worthless-trash|19 days ago

Can I use this for erlang instead of elixir?

bartblast|19 days ago

Not currently, but expanding to Erlang is definitely possible down the road. I've actually been considering adding an Erlang compiler since some Erlang functions that the Elixir standard library depends on could be compiled automatically instead of being ported by hand.

aliljet|19 days ago

Am I just a cynic, or do any of the LLMs deserve love too?