Modal Title
Frontend Development / Rust / Software Development

Toolkit Allows JavaScript Devs to Program Embedded Devices

Slint is a new Rust-based UI toolkit that lets JavaScript programmers create embedded and desktop applications.
Mar 23rd, 2023 11:06am by
Featued image for: Toolkit Allows JavaScript Devs to Program Embedded Devices
Image via Shutterstock

A new toolkit enables JavaScript developers to create native user interfaces for embedded and desktop applications. Called Slint, it also supports programming in C++ or Rust.

Slint is the creation of a startup called SixtyFPS GmbH. The Rust-based UI toolkit recently won first place in the tooling category at the 2023 Embedded World conference. Though the tool is written in Rust, that is obscured for the developer. Instead, the developer interacts with JavaScript, Rust or C++ libraries to build the UI interface, but underneath Rust provides a base for the tool, said Olivier Goffart, a co-founder of SixtyFPS GmbH.

“We said from the beginning, we want this to be supported by several programming languages because in 10 or 20 years when Rust will not be good anymore, we want to be able to swap that for the user so that they can write in their language,” Goffart told The New Stack. “Rust [is] not really a great language to write the application logic itself, as you do not often need so much performance for the application logic.”

But it was easy to support Rust in the application because it’s the implementation language. It was also easy to support C++ because it’s compiled and the team came from that ecosystem. Finally, they wanted to support JavaScript because it’s a dynamic language. If they can support those three languages initially, then they think they will be able to support all languages eventually.

Although the Slint creators were experienced with C++, they thought Rust had better tooling and felt more modern than C++, while still having the potential of C++. It also had the added benefit of being safer, Goffart added.

“We wanted something that can be really fast, because when you run an embedded [app], every cycle of the CPU counts — and so we cannot afford a garbage collector,” Goffart said.

Garbage collector languages monitor memory allocation and reclaim blocks of allocated memory that’s no longer needed. JavaScript, C# and Java are examples of garbage collector languages.

Slint compiles the application to run natively on embedded devices, or on Linux, Mac, and Windows desktops.

How Slint Works and Why It’s Embedded

Slint is implemented in Rust, but the API for it is written in a domain specific language called the Slint language. Then there is an API to connect to the supported language libraries.

“If you only know C++, you don’t need to care about Rust. If you only know JavaScript, you don’t need to care about Rust,” he said.

SixtyFPS GmbH opted to go after the embedded space because there’s less competition than in the web UI space. It’s arguably more lucrative as well, they believe. The tool is designed to work on the “really low end” of embedded devices, which tend to have low compute power, Goffart explained.

“There are different levels of embedded — there is a really cheap microprocessor that can run only compiled code and doesn’t have much memory, then there is the high-end embedded, which is sometimes even more powerful [than]… a personal computer,” he said. “Since we scale, we can also support more and more computers that are either not perfect at all, or that even have hardware accelerators — so, anything that can display a user interface.”

On the high-end embedded side, the tool “can easily support JavaScript,” he said. In fact, some in the industry already use JavaScript by placing a browser on the embedded system, he added. So it made sense to the Slint team to use JavaScript, but without the added weight of the browser.

Why the Desktop?

There is a trend right now to use the browser as the basis to create web pages that run like desktop applications as well, Goffart said. For Slint, the team wanted to enable a native-looking user interface on the desktop.

“We want to offer a way to make a user interface that is not in the browser, so it’s native and it looks like a real application for a computer and not a website,” Goffart said. “We think that native styling is important so that all the controls look like the operating system’s controls.”

Right now, the tool team is focused on what developers need to create a UI.

“If you make the display panel a control panel for some industrial machine that bends metal in some factory, you’re not going to hire an agency to create a beautiful design for it,” said Simon Hausmann, also a SixtyFPS GmbH co-founder. “You’re going to task yourself or [your] developers to implement the functionality as easily as possible, as quickly as possible. It should be usable, of course, and it should look decent, but you’re not going to focus on the design aspects so much.”

In the future, that may change — their plan is to make Slint into a tool that designers could use alongside developers.

“We want to not only target software developers but also the designers; so that the designers and software developers can more easily work together, with the focus on products that are either embedded devices [or] applications that run on laptops, for example,” Goffart said.

Slint is dual licensed, which means developers can license it under the GPL version 3, an open source license, or under a proprietary license that allows using Slint in products where the owner does not wish to make their source code available. The proprietary license is available by purchasing a copy or taking part in Slint’s ambassador program, where developers exchange a free proprietary license for branding the app as built using Slint. Competitors include free products and QT, where Hausmann previously worked.

Group Created with Sketch.
TNS owner Insight Partners is an investor in: The New Stack.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.