3 ms·
Their home page says it is: > Running on the battle-tested Erlang virtual machine that powers planet-scale systems such as WhatsApp and Ericsson, Gleam is read
by mcintyre1994 2y ago
Their home page says it is:
> Running on the battle-tested Erlang virtual machine that powers planet-scale systems such as WhatsApp and Ericsson, Gleam is ready for workloads of any size.
> Thanks to a multi-core actor based concurrency system that can run millions of concurrent tasks, fast immutable data structures, and a concurrent garbage collector that never stops the world, your service can scale and stay lightning fast with ease.
It's accompanied by a code example with 200,000 async tasks being spawned.
- ModernMech 2y agoIndeed, yes that bit on the homepage is what caused me to write what I did. I ran that code, but it does not run; it tells me that "task" is not defined. I read the "language tour", but it wasn't covered. So I went to the standard library to find out what "task" is, but it's not there. I went to the docs to learn what "async" is, but it's not mentioned. I went to the "gleam for rust users" doc because I was hoping it would give me a "gleam vs rust" concurrency primer, but no luck. Based on this, I feel that concurrency is maybe an afterthought in Gleam, which surprised me, because that's not what I had expected seeing as it runs on BEAM.
- mcintyre1994 2y agoGot you. I guess it comes from `gleam/otp/task` in the link you posted, the API matches. But it does seem to be missing from eg the language walkthrough. If I had to guess it'll be because it's a light wrapper around Beam/OTP primitives, and the initial audience for Gleam was probably developers already using the Beam with eg Elixir and familiar with its concurrency already. It definitely looks like it's expanded beyond that though.
- cess11 2y agoLoad the module: https://hexdocs.pm/gleam_otp/gleam/otp/task.html https://hexdocs.pm/gleam_otp/gleam/otp/task.html import gleam/otp/task How modules work is covered by the language tour, and to do something interesting you'll probably want more than just the task module. The concurrency stuff isn't as fleshed out in Gleam as it is in Elixir or Erlang, as I understand it because it's not the project's focus and due to how the type system works.
- lawn 2y agoI think I've heard that it's implemented as a library because we're not sure about the best way to implement the concurrency stuff. It's easier to experiment in a library than in the core.
- cess11 2y agoRight, yeah, maybe I read that it's something like the typing system putting constraints on direct interop, I'm not sure. I mostly follow from the sidelines, having a deeper buyin with Elixir, but whenever I find the time and a use case I'll build something in Gleam and learn more.
- lpil 2y agoIt's not an afterthought at all, but due to Gleam being a new language we do not have much documentation for the actor framework, so you are largely expected to be familiar with Erlang's implementation. The community voted that the LSP is more important than documenting, polishing, and expanding the actor framework so that is what the core team is currently focusing on.