Published 25 Oct, 2022 by Louis Pilfold
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!
- Adam Brodzinski
- Adi Iyengar
- Adriano Santos
- Alembic
- Alex Manning
- Alex Strand
- Alexander Koutmos
- Ali Farhadi
- Anthony Scotti
- Arnaud Berthomier
- Arno Dirlam
- Ben Marx
- Ben Myles
- Benjamin
- brettkolodny
- Brian Glusman
- Bruno Michel
- Bryan Paxton
- Carlos Saltos
- Charlie Duong
- Chew Choon Keat
- Chris Lloyd
- Chris Young
- Christian Meunier
- Christopher Keele
- clangley
- Clay
- Cole Lawrence
- Colin
- Copple
- Cristine Guadelupe
- Damir Vandic
- Dan Dresselhaus
- Dan Mueller
- Dashuang Li
- Dave Lucia
- David Armstrong Lewis
- David Bernheisel
- David Flanagan
- Dennis Tel
- Edon Gashi
- eko234
- Elliott Pogue
- Eric Meadows-Jönsson
- Erik Terpstra
- Fernando Farias
- Filip Figiel
- Florian Kraft
- fly.io
- Graeme Coupar
- Guilherme de Maio
- Gustavo Villa
- Harry Bairstow
- Hayleigh Thompson
- Henry Warren
- human154
- Ian González
- Ingmar Gagen
- inoas
- Ivar Vong
- James MacAulay
- Jan Skriver Sørensen
- Jen Stehlik
- jiangplus
- John Gallagher
- John Palgut
- Jonathan Arnett
- josh rotenberg
- José Valim
- Josías Alvarado
- João Veiga
- Julian Schurhammer
- Julien D
- Justin Blake
- Kapp Technology
- Kayla Washburn
- Kieran Gill
- Lars Wikman
- Lucas Avila
- Marcel Lanz
- Marcin Puc
- Marius Kalvø
- Mark Holmes
- Mark Markaryan
- Markus
- Martin Janiczek
- Mathias Jean Johansen
- Matt Van Horn
- Max Lee
- Michael Chris Lopez
- Michael Jones
- Michał Kowieski
- Michele Riva
- Mike Lapping
- Mike Roach
- Milton Mazzarri
- Nathaniel Knight
- Nick Reynolds
- Nicklas Sindlev Andersen
- NineFX
- OldhamMade
- Ole Michaelis
- Oliver Searle-Barnes
- ontofractal
- Parker Selbert
- Patrik Svensson
- Pete Jodo
- porkbrain
- Praveen Perera
- qingliangcn
- Quinn Wilton
- Raúl Chouza
- Redmar Kerkhoff
- Reio Piller
- Rodrigo Oler
- Ryan Winchester
- Sam Aaron
- Sascha Wolf
- Saša Jurić
- Scott Wey
- Sean Jensen-Grey
- Sebastian Porto
- shayan javani
- Shunji Lin
- Shuqian Hon
- Signal Insights
- Simone Vittori
- Smaehtin
- Stefan Luptak
- Strand Communications
- Szymon Wygnański
- t bjornrud
- Terje Bakken
- Tomasz Kowal
- Tomochika Hara
- Tristan de Cacqueray
- Tristan Sloughter
- tynanbe
- Uku Taht
- Vincent Le Goff
- Weizheng Liu
- Wilson Silva
- Wojtek Mach
- YourMother-really
- Yu Matsuzawa
- zaatas
- Zsombor Gasparin
- Étienne Lévesque
Thanks for reading! Happy hacking! 💜