I find it very handy that the intermediate Erlang (or JS) files are available in the build directory. It lets you easily see what form your code will take when compiled.
It seems that Gleam is really useful for those who are already in either the Erlang/Javascript ecosystem.
For me personally, the Javascript target is the least interesting bit - the BEAM/Erlang target is where it's at for backend work. The BEAM is fascinating and full of ideas that were once ahead-of-their-time but now are really coming into their own with compute performance having caught up.
Gleam is a strongly typed language, and is unapologetically very functional. Error handling in general is quite different than it would be on a normal stack-based language/vm. In my experience, the Erlang target doesn't make debugging any harder or more difficult than you would expect for an exception-less language.
I've created Vleam[0] to convert an existing vue webapp[1] and so far it's a joy.
[0]: https://github.com/vleam/vleam
[1]: https://blog.nestful.app/p/why-i-rewrote-nestful-in-gleam
Besides, Gleam's original aim was basically "Erlang but static types", so the choice of Erlang as runtime was always there.
https://blog.lambdaclass.com/an-interview-with-the-creator-o...
> The Gleam compiler has had a few full rewrites. The previous version compiled to BEAM bytecode via Core Erlang, which is an intermediate representation with the Erlang compiler, but the current version compiles to regular Erlang source code that has been pretty-printed. This has a few nice advantages such as providing an escape hatch for people who no longer wish to use Gleam, and enabling Erlang/Elixir/etc projects to use libraries written in Gleam without having to install the Gleam compiler.
Pretty good reasoning in my opinion.
It would be great if the BEAM had a source map like system so it can have the same high quality runtime errors and debugger support that JS has, but I think that’s unlikely to ever happen.
A REPL would be nice, but there hasn’t been enough demand to motivate any work so far. Language server features are overwhelming the majority of demand when it comes to tooling.