Programming language: Gleam 0.18 brings a new build tool to the Erlang ecosystem

Share your love

The type-safe, scalable programming language Gleam was released in version 0.18. Gleam belongs to the Erlang ecosystem and is designed for the Erlang Virtual Machine, but should also work with JavaScript, among other things. The most important innovation of the new release is an independent build tool for the language, which the community has been waiting for a long time, according to the publishers.

As can be seen in the blog entry for the announcement, Gleam developers previously had to use the standard build tool of the Erlang programming language for their projects. rebar3 is considered a useful tool for builds, but was not tailored to Gleam and should hold some hurdles and surprises for beginners in the language. According to the editors, the new tool sits better and allows development teams to work more focused on the Gleam code with a more pleasant developer experience.

Gleam’s build tool is included in the Gleam binary. Therefore, everyone who downloads version 0.18 automatically has the build tool and does not have to install anything separately. Projects can still be started with the command gleam new invest. The application code is in the src directory, test code in the test directory. A freshly created project looks like this, for example:

$ tree
# ├──
# ├── gleam.toml
# ├── src
# │   └── my_project.gleam
# └── test
#     └── my_project_test.gleam

If you work with Gleam, you no longer have to execute the code in the Erlang shell, which was previously the standard way under rebar3 and should have irritated developers. Instead, the new build tool offers a command more familiar to Gleam developers:

Read Also   Kuiper vs. Starlink: Amazon subsidiary complains about new Starlink satellites

$ cd my_project
$ gleam run
#   Resolving versions
# Downloading packages
#  Downloaded 2 packages in 0.01s
#   Compiling gleam_stdlib
#   Compiling gleeunit
#   Compiling my_project
#    Compiled in 1.85s
#     Running my_project.main
# Hello from my_project!

Once the build tool is running, it will automatically download and compile the dependency packages as well as the project. Only in the next step does it start the Erlang Virtual Machine (BEAM) and call the main-Function of the Gleam project. Dependencies are automatically saved in a project-specific sandbox, which means that a virtual environment or other tools are no longer necessary. The current release also puts testing on a new footing: Gleam projects are already preconfigured with gleeunit, a wrapper around the Erlang test framework EUnit. Tests can be run with the following command:

$ gleam test
#   Compiling my_project
#    Compiled in 0.24s
#     Running my_project_test.main
# .
# Finished in 0.008 seconds
# 1 tests, 0 failures

The command gleam test should behave similarly to gleam runby downloading and compiling the dependencies as needed. For gleam testing, however, developers are not committed to gleeunit; other test frameworks are also possible as long as they are written in BEAM languages ​​such as Erlang or Elixir. Gleam projects also contain a file in which project-specific metadata such as the project name, version and any dependency can be specified. How are dependencies in the gleam.toml– have the file supplemented, the blog entry on the Gleam website demonstrates with examples.

Gleam is based on the Erlang Virtual Machine and mainly uses the Erlang Runtime, according to the publisher without overhead. This should run programs written in Gleam as fast and multithreaded as their counterparts written in Erlang. Gleam is compatible with other BEAM languages ​​such as Erlang, Elixir and LFE (Lisp-Flavored Erlang), giving users of the language an extensive ecosystem with thousands of open source libraries. Those who are more interested in it will like one Take a look at the website of hex, the package manager for the Erlang ecosystem. BEAM is the virtual machine at the core of the Erlang Open Telecom Platform (OTP) and part of the Erlang Runtime System (ERTS), which compiles Erlang source code into bytecode, which can then be executed on BEAM.

Read Also   Version management: Git 2.34 thins the index

According to the editors, security aspects are in the foreground, so Gleam’s statically typed system is supposed to search for and find errors at compile time before they reach the users. Some teams use it in production for refactoring, as Gleam can also be used to make large changes to unknown code quickly with little risk. The highlights of the language include actuator-based multi-core concurrency, algebraic data types, Erlang-style error tolerance, rapid compilation, full type inference, detailed error messages, generics, no undefined behavior and reliable package management. In addition to the community, there are four sponsors behind Gleam: NineFX, the Estonian Yolo group, Memo and SkunkWerks from Vienna.

Further improvements to the developer experience are planned for the future, with the Gleam team focusing on the Language Server Protocol for IDE features in code editors and support for the JavaScript compiler backend. The Gleam developers also have the deployment and the associated functionalities on the screen for upcoming releases.

Gleam is on GitHub to find. You can find out more about the current release see the blog entry on the Gleam website. The first announcement was made by the Gleam team posted on twitter. All changes compared to the previous version lists the changelog on GitHub. For the curious without any Gleam or BEAM experience a guide is available to get you started.


Article Source

Share your love