Gleam doesn't compile to Erlang source anymore

276 points - today at 8:08 AM

Source

Comments

jmcgough today at 9:34 PM
Louis is amazing. So cool to see how he's grown this project since starting it.
0x69420 today 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 today 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.
MichaelNolan today 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.
zachrip today 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.
tiffanyh today 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.

olexsmir today 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 :(
desireco42 today 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.
__jonas today 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
impoppy today 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.
vortegne today at 10:59 AM
Congratulations to the team! I love Gleam and am genuinely having fun every time I write Gleam code.
lexx today at 12:11 PM
Amazing news! Thank you!
tasuki today at 7:19 PM
...and many other improvements!

I was surprised to find Matt Mullenweg among the sponsors.

PKop today 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.

karel-3d today 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.

corbinvachal today at 3:01 PM
[flagged]
massimodeluisa today at 3:01 PM
[flagged]
fpemberton today at 3:19 PM
[flagged]
deleted today at 10:19 AM
quietFalcon today at 11:17 AM
[flagged]
jazzypants today at 1:11 PM
Let me guess: still no string interpolation in a language ostensibly intended for building user interfaces?
phcreery today at 11:44 AM
The misuse of commas is distracting; at least it’s better than reading ai blogs.
nwalkr today 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.

capitanazo77 today 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