Top
Best
New

Posted by ingve 14 hours ago

Gleam doesn't compile to Erlang source anymore(gleam.run)
276 points | 115 commentspage 2
impoppy 9 hours ago|
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.
lpil 9 hours ago|
We did not (and still don't) have an internal Erlang AST representation in the compiler. Previously we did have a Gleam AST -> printing algebra -> Erlang source pipeline, now we construct a buffer of bytes with the data encoded as Erlang Term Format.

Source was the previous target as at the time Erlang Abstract Terms was not established as the go-to format (Core Erlang was more popular but it did not have a stable API outside of the BEAM, so Gleam's in-Rust compiler could not construct it), and due to the newness of the language having an "escape hatch" where one could abandon Gleam and eject to Erlang was highly valuable. It also meant we could use the Erlang build tool until the Gleam one was ready for use.

vortegne 11 hours ago||
Congratulations to the team! I love Gleam and am genuinely having fun every time I write Gleam code.
lexx 10 hours ago||
Amazing news! Thank you!
PKop 5 hours ago||
> "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.

lpil 1 hour ago|
The old one had an inferior implementation, but that is unrelated to the output format. We also have a new Erlang source code generator that is used predominantly in the compiler test suite, and it too is superior.
tasuki 3 hours ago||
...and many other improvements!

I was surprised to find Matt Mullenweg among the sponsors.

karel-3d 8 hours ago||
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.

lpil 7 hours ago||
Gleam is a simple functional programming language which leans into static typing , friendly tooling, and a one-way-to-do-it style. You'd want to use it if you enjoy the programming experience it provides.
jeltz 7 hours ago||
It is if you want Erlang but typesafe and with a modern syntax. And why would you want Erlang? Erlang was built for making it easy to build fault-tolerant concurrent applications, for example in telecom.
corbinvachal 7 hours ago||
[flagged]
massimodeluisa 7 hours ago||
[flagged]
fpemberton 7 hours ago||
[flagged]
More comments...