4

Gleam v0.23 released!

 2 years ago
source link: https://gleam.run/news/gleam-v0.23-released/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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

Elixir support

Gleam runs on the Erlang virtual machine alongside an assortment of other excellent languages, and as such we want to take advantage of all the packages written in those languages.

Previously projects using Gleam’s build tool could depend on packages written in Gleam or Erlang. With this release projects written in Elixir are also supported, giving Gleam programmers access to practically all the packages found on Hex, the package manager for the Erlang ecosystem.

The developer-experience for using Elixir packages in Gleam is the same as using Erlang packages.

# Add an Elixir package to the Gleam project
$ gleam add tzdata
// Import a function from the package
external fn tzdata_version() -> String =
  "Elixir.Tzdata" "tzdata_version"

// Use it in Gleam
pub fn main() {
  io.println(tzdata_version())
}

Thank you to Tynan Beatty for this feature, and thank you to the Elixir community for all they give to the BEAM ecosystem!

Package updating

We want it to be as easy as possible to use code written by others, and we want to avoid “dependency hell”, so the user experience of the build tool is an important area for Gleam.

One missing part of the puzzle so far as been upgrading the package versions that your project depends on. It has largely been a manual process previously.

With this release there is a new gleam update command which will efficiently resolve the latest compatible versions for dependencies using the PubGrub algorithm.

$ gleam update
# Tada, you're on the latest versions!

Searchable documentation

Gleam generates documentation for packages and publishes the HTML to HexDocs, the documentation site for the Erlang ecosystem.

With this release generated documentation includes a search bar so that functions, types, and modules can be found faster than easier than ever. The search is powered by the Lunr JavaScript library and as such supports fuzz-matching to help with typos, or for when you can’t quite remember the name of what you’re after.

Give the documentation search a try with the standard library documentation today.

Thank you to Lucas de Ávila Martins for this feature!

And more

Those are the main features, but there’s also an assortment of other changes:

  • Constant expressions can now contain and reference functions. Thank you Eddie Hatfield!
  • Compiler performance has been improved by buffering outputs and lazily loading resources. In tests this quadrupled performance when compiling the standard library.
  • The LSP will now provide rudimentary autocompletion for importable modules.
  • The code formatter style has been improved.
  • The gleam publish command will include the priv directory (for non-code package artefacts) and can be run non-interactively. Thank you Tynan Beatty!

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! 💜


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK