Gleam is a type safe and scalable language for the Erlang virtual machine and JavaScript runtimes. Today Gleam v0.24.0 has been released, let’s take a look at what’s new.

In-project Elixir support

The Gleam build tool has always supported compilation of modules written in Gleam or Erlang, but now it supports Elixir modules as well. Any .ex files of Elixir code in the src directory will be automatically compiled for you when you run gleam build, gleam test, etc.

$ tree
# .
# ├── gleam.toml
# └── src
#     └── project.ex
# 1 directories, 2 files
$ gleam run
# Hello from Elixir in a Gleam project!

This means that Gleam projects can now make full use of Elixir code and libraries, including those that use Elixir’s macro system, which cannot be used directly from other languages.

Note this does not mean that we are type checking Elixir code or can tell the type signatures of any Elixir functions. Elixir code will continue to be imported using Gleam’s external functions feature.

Thank you to Tynan Beatty for this feature, and for his tireless work on Gleam-Elixir interop.

<> operator

Gleam now has a <> operator which works on strings. In an expression it immutably concatenates two strings into a new one.

let who = "Joe"
"Hello, " <> who <> "!"
// => "Hello, Joe!"

When used in a pattern it can be used to match strings that have a given prefix.

case input {
  "Hello, " <> name -> name
  _other -> "Unknown"

These new string patterns means that we can write string parsers that compile to efficient Erlang bytecode using the virtual machine’s highly optimised pattern matching functionality.

As a little demo, here’s a toy Lisp interpreter written in Gleam that uses this feature: gleam-lang/example-lisp-interpreter.

The Developer Survey

If you’re a Gleam user, or just someone who is interested in Gleam, please consider filling in this year’s Gleam Developer Survey. Gleam’s community is growing so we’re keen to get a better understanding of who you folks are and how we could make Gleam even better for you. Once we have this information we will use it to influence and prioritise Gleam development in 2023.

The survey is an in-browser single-page-application and web service backend, both written in Gleam and deployed to Fly. If you’d like to read the source code it can be found on GitHub.

And more

In addition to those main features we’ve fixed bugs and improved error messages, the highlights being:

Elixir dependency package support now works on Windows. Thank you Smaehtin!

If the programmer attempts to use the object-oriented method call syntax (value.method()) we now return a more detailed error that explains that Gleam is not object oriented, and suggests using the functional syntax. This will hopefully help people who are less familiar with functional programming languages.

For all the changes see the changelog file on GitHub.

How can I try it?

Instructions on how to install the latest version of Gleam can be found on the getting started page of the website. Once installed check out the language tour for an introduction to the language.

Supporting Gleam

If you would like to support me in making Gleam please consider sponsoring Gleam or asking your employer to sponsor Gleam. Every donation makes a difference, no matter how small, so thank you for your help.

Or alternatively give us a star on GitHub! ⭐

And thank you!

Gleam is made possible by the support of all the people who have sponsored and contributed to the project. Thank you all!

Thanks for reading! Happy hacking! 💜