upvote
Do you like Rust or do you like Erlang? Writing Gleam is like writing Rust, writing Elixir is like writing Erlang.

I don't know the current state of Gleam OTP, but last I checked it wasn't great.

If you don't care about either of those things and only about types, use Gleam. But then why not just use Rust?

reply
Hi, I'm the lead maintainer of Gleam.

> I don't know the current state of Gleam OTP, but last I checked it wasn't great.

Gleam uses regular OTP, it doesn't have a distinct OTP framework separate from other BEAM languages.

reply
Your last sentence is basically where I'm at, writing my backends in Rust these days. I'm interested in the BEAM promise of letting things crash but not sure how good that is in Gleam due to its OTP still being somewhat immature as the devs are rewriting GenServer as a typed library.
reply
Hello! I'm the maintainer of Gleam. We are not rewriting OTP, regular OTP is used in Gleam. Most commonly the typed Gleam APIs for OTP are used, but you can use the untyped Erlang APIs if you wish.

This is the same as in Elixir, where macro-enabled APIs are offered, and they just wrap the regular Erlang APIs.

reply
> But then why not just use Rust?

The BEAM?

reply
> writing Elixir is like writing Erlang

I wrote both Elixir and Erlang code. Erlang is just useless to me as a programming language; it has many great ideas though. I love the idea of being able to think in terms of immortal, re-usable, safe objects (Erlang does not call these objects, but to me this is OOP by Alan Kay's definition. I don't use e. g. the java definition for OOP.)

Elixir built on that and made Erlang code optional, meaning people could write more pleasent code. And here it succeeded. I am not sure why Elixir succumbed to type madness now, but the comment that "writing Elixir is like writing Erlang", is just simply not true.

Elixir is significantly better than Erlang with regard to writing code. José Valim got inspiration for Elixir from ruby, to some extent.

reply
You're taking my comment way too literally. I'm basically just making a syntax comparison. Obviously Rust is not at all like Gleam in many ways either. It's just statically typed and has a similar syntax.
reply
I agree that actor languages are the purest form of OOP as Alan Kay has expressed it. And unlike Smalltalk, Erlang just accepts that some things are naturally functions, not messages.
reply
Smalltalk has no problem at all with accepting that some things are naturally functions: it has always had blocks! The call operator is `value`, not `()`, but it's the same "apply a piece of code to some values" operation.
reply
Erlang's Joe Armstrong and Alan Kay did a talk/interview together:

https://www.youtube.com/watch?v=fhOHn9TClXY

reply
Why do you find Erlang useless, you just don't like the syntax?
reply
They're different languages with different syntax and different features. Them using tge same VM doesn't really make them competing products, just like Java, Scala, and Clojure all use JVM and yet are all different languages
reply
Check Gleam website, they have the comparison right there.
reply
Last I checked there were inacuracies. I am not sure if they have been addressed!
reply
What were the inaccuracies? I'm not aware of any, but we can fix any that are found right away.
reply
There are two possible locations for comparison that I can see:

https://gleam.run/frequently-asked-questions/#Elixir Here’s a non-exhaustive list of differences:

    Elixir is gradually typed, while Gleam is fully statically typed.
    Elixir's type system does not have generics, while Gleam's type system does.
    Elixir has a powerful macro system, Gleam has no metaprogramming features.
    Elixir’s compiler is written in Erlang and Elixir, Gleam’s is written in Rust.
    Gleam has a more traditional C family style syntax.
    Elixir has a namespace for module functions and another for variables, Gleam has one unified namespace (so there’s no special fun.() syntax).
    Gleam standard library is distributed as Hex packages, which makes interoperability with other BEAM languages easier.
    Elixir is a larger language, featuring numerous language features not present in Gleam.
    Elixir has an official test framework with excellent support for concurrency, partitioning, parameterized tests, integrated error reports, and more. Gleam has no official test framework, but there are multiple community-maintained frameworks.
    Both languages compile to Erlang but Elixir compiles to Erlang abstract format, while Gleam compiles to Erlang source. Gleam can also compile to JavaScript.
    Elixir has superior BEAM runtime integration, featuring accurate stack traces and full support for tools such as code coverage, profiling, and more. Gleam’s support is much weaker due to going via Erlang source, resulting in less accurate line numbers with these tools.
    Elixir and Gleam both use Erlang's OTP framework. Both have additional modules for working with OTP, which provide APIs more in the style of each respective language. Both common use Erlang's OTP APIs directly, but Elixir can do so more conveniently and concisely due to having a less-strict type system.
    Elixir currently has superior deployment tooling, including support for OTP releases and OTP umbrella applications.
    Gleam’s editor tooling is superior due to having a more mature official language server, but Elixir has recently announced an official language server project which is in active development.
    Elixir is more mature than Gleam and has a much larger ecosystem.
    Gleam and Elixir compile at similar speeds due to using the Erlang compiler as their compiler backend. Elixir's macros are evaluated at compile time, so a program that uses macros will take longer to compile the larger the amount of work performed in macros. Gleam has no language features that result in slower compilation.
https://gleam.run/cheatsheets/gleam-for-elixir-users/ This has to much content to reproduce.
reply
We should really remove the cheatsheets, they have not been maintained in many years.
reply
Gleam doesn't have macros, which many Elixir libraries (such as Phoenix and Ecto) uses to great effect.

Gleam for example has issues with verbosity of decoding/encoding json whereas in Rust you derive serde and in Elixir it's just a function call away.

Elixir has a more mature ecosystem. While you can for example use Phoenix with Gleam (or some other Gleam framework) the experience just isn't the same.

The big draw with Gleam over Elixir is the typing (where Elixir is now closing the gap) and being able to compile to JavaScript (which is also what Hologram is doing for Elixir).

I prefer Gleam's typing system and the Rust-like syntax, but for now I feel Elixir is the better choice for all my web dev projects.

reply
> and being able to compile to JavaScript

Apparently it is not that difficult to add different compiler backends. There was a presentation [0] recently about adding wasm support as a compiler target. The implementation was quite far along, including support for the wasm component model.

[0] https://www.youtube.com/watch?v=UQ0--ODjiDk

reply
Just to add a slight correction here, support for the wasm component model wasn't added in the target I wrote
reply
That was a misunderstanding then, thank you for correcting.
reply
Phoenix and Ecto, really.
reply