logoalt Hacker News

Gleam doesn't compile to Erlang source anymore

299 points • by ingve • yesterday at 8:08 AM • 127 comments • view on HN

Comments

0x69420 • yesterday at 11:37 AM

to those curious, erlang abstract form[1] is the AST representation used by the erlang compiler/etc. per [1], you can see that it's canonically made of erlang terms, and you have easy access to routines for manipulating this representation from the standard library; it's really comfy when you need it! it's also the target elixir compiles down to, and the representation manipulated by parse transforms, which in base erlang are the way syntactic sugar (notably qlc[2] and some of the more cutesy pattern matches in merl[3] (which, in turn, manipulates the very same representation to do its job. very meta!)) is done.

most BEAM languages actually settle on erlang abstract format. you'd think core erlang would be more common since it feels more like a traditional functional IR, but basically only LFE does this, because it's a moving target without any particular stability guarantees from release to release.

1: https://www.erlang.org/doc/apps/stdlib/erl_parse.html#t:abst...

2: https://www.erlang.org/doc/apps/stdlib/qlc.html#q/2

3: https://www.erlang.org/doc/apps/syntax_tools/merl.html

giancarlostoro • yesterday at 2:21 PM

Erlang is one of those runtimes I've loved since learning about it all the way back in 2008, but I never took time to learn the syntax, but Elixir and Gleam have had me fiddling with the Erlang VM over the years. Happy to see Gleam growing into maturity.

➕ show 2 replies
zachrip • yesterday at 11:30 AM

Shout out to Giacomo's twitch streams. He has taught me about some features of Gleam, Rust, and on top of that he's just a very chill person. He takes time away from his focus to answer questions politely and without judgement. There are dozens of programming streams where the streamer forgets to leave their ego at the door and he is not one of them. I highly recommend following it.

➕ show 4 replies
MichaelNolan • yesterday at 1:30 PM

Gleam is such a beautiful language. I wish I had the opportunity to use it more. If it could compile (transpile) to a native target like rust or go, it would be truly perfect.

➕ show 5 replies
sltr • today at 12:42 AM

Gleam is my new default language and ecosystem. Until last year, I first reached for .NET on new projects. ".NET everywhere" and such. But Blazor apps are huge and slow. These days I often advocate first for Gleam. With Lustre and Tauri it can run anywhere.

tiffanyh • yesterday at 4:53 PM

The title is a bit misleading because one might imply that Gleam no longer compiles to something Erlang can use (not true).

From the article:

> Over the last few months Giacomo Cavalieri has entirely rewritten Gleam's Erlang code generator that has an entirely different design, and most notably, outputs a different format. Previously Gleam generated Erlang source code, now it generates Erlang abstract forms.

➕ show 1 reply
tmountain • yesterday at 9:41 PM

I love this language, but I have to wonder how much harder it is to grow a niche language these days when everyone is just telling Claude what to build for them. It seems like LLM friendliness is going to become the new benchmark for adoption if it hasn't already, and I find that pretty sad.

➕ show 1 reply
olexsmir • yesterday at 3:37 PM

I love seeing how gleam gets better and better with every release, sadly I dont have any projects where I could use gleam :(

__jonas • yesterday at 12:55 PM

Pretty exciting change that I didn’t see coming —- I wonder if someone will end up implementing an integration with the Whatsapp Erlang debugger

➕ show 1 reply
impoppy • yesterday at 1:14 PM

This raises an obvious question. Why Gleam team weren't doing that in the first place? Obviously they didn't have direct Gleam AST -> Erlang source pipeline, they must have had to build some their own custom Erlang AST representation that they then translated into the source code.

➕ show 1 reply
jmcgough • yesterday at 9:34 PM

Louis is amazing. So cool to see how he's grown this project since starting it.

vortegne • yesterday at 10:59 AM

Congratulations to the team! I love Gleam and am genuinely having fun every time I write Gleam code.

lexx • yesterday at 12:11 PM

Amazing news! Thank you!

desireco42 • yesterday at 9:21 PM

I will just say, as of recently, especially thanks to AI, I've been doing projects in Gleam, I am on third Gleam project and it has been very pleasant experience. It takes longer to write but it is much shorter, easier to follow and much more easier to update and change.

PKop • yesterday at 5:26 PM

> "Transpiler" means a compiler that outputs a human-readable format, such as source code. It's a cool sounding word, but most the time people use it to imply that a given compiler is in some way inferior. This is very silly, as there is nothing about compiling to a human-readable format that makes a compiler easier to implement.

Ok but this footnote comes at the end of a paragraph describing how the previous transpiler implementation was inferior to the new compiler. It's ok to make these distinctions.

➕ show 1 reply
tasuki • yesterday at 7:19 PM

...and many other improvements!

I was surprised to find Matt Mullenweg among the sponsors.

karel-3d • yesterday at 1:47 PM

What is Gleam? Where would I want to use it?

All I understand from the frontpage is that it's typesafe. Good I guess? Then there is something about Erlang which I never used.

➕ show 2 replies
corbinvachal • yesterday at 3:01 PM

[flagged]

massimodeluisa • yesterday at 3:01 PM

[flagged]

fpemberton • yesterday at 3:19 PM

[flagged]

quietFalcon • yesterday at 11:17 AM

[flagged]

➕ show 2 replies
jazzypants • yesterday at 1:11 PM

Let me guess: still no string interpolation in a language ostensibly intended for building user interfaces?

➕ show 2 replies
phcreery • yesterday at 11:44 AM

The misuse of commas is distracting; at least it’s better than reading ai blogs.

➕ show 2 replies
nwalkr • yesterday at 12:14 PM

idk, i'm not sure about wording. erlang abstract form still is erlang source, it's ast of erlang source text. one call to erl_prettypr:format and text source is back. word 'transpiler' is still there and there is nothing "pejorative" in it, it's transpilers all the way down everywhere.

but talking pejorative, i was surprised. my opinion of gleam was already pretty low, but i did not expect to see post-1.0 compiler emitting text erlang source. maybe it's not that good of idea to implement compiler in language completely foreign to target ecosystem.

➕ show 1 reply
capitanazo77 • yesterday at 4:10 PM

When will they change their image to not look like girl toys?

Imagine a doctor about to do surgery and opening a toy box

➕ show 4 replies