A new toolkit enables JavaScript developers to create native user interfaces for embedded and desktop applications. It’s called Slint and also supports programming in C++ or Rust.
Slint is the creation of a startup called SixtyFPS GmbH. His Rust-based UI toolkit recently won him first place in his category of tools at the 2023 Embedded World conference. This tool is written in Rust, but is unknown to developers. Instead, the developer interacts with JavaScript, Rust, or C++ libraries to build his UI interfaces, but underneath Rust comes a base of tools, says SixtyFPS GmbH co-founder Founder Olivier Goffart said:
“From the beginning, we said we wanted some programming language to support this, because in 10 or 20 years, when Rust is no longer good, people can write in their own language. Because we want to be able to replace it,” Gophert told The New Stack. “rust [is] It’s not the best language to write the application logic itself, because in many cases the performance of the application logic isn’t needed that much. ”
But since Rust is an implementation language, it was easy to support Rust in our application. Supporting C++ was easy because C++ was compiled and the team came from that ecosystem. Finally, we wanted to support JavaScript, a dynamic language. We believe that if we can support these three languages initially, we will eventually be able to support all of them.
The creators of Slint had some experience with C++, but thought Rust had better tools and felt more modern than C++, while retaining C++’s potential. It also had the added benefit of being more secure, Goffart added.
“We wanted something really fast. [app]every cycle of the CPU counts, so there is no room for a garbage collector,” Goffart said.
A garbage collector language monitors memory allocations and reclaims blocks of allocated memory that are no longer needed. JavaScript, C#, and Java are examples of garbage collector languages.
Slint compiles applications to run natively on embedded devices or on Linux, Mac, and Windows desktops.
How Slint works and why it’s included
Slint is implemented in Rust, but its API is written in a domain-specific language called the Slint language. Then there are APIs for connecting to supported language libraries.
“If you only know C++, don’t bother with Rust. If you only know JavaScript, don’t bother with Rust,” he said.
SixtyFPS GmbH chose to target the embedded space as it has less competition than the web UI space. It’s definitely more profitable, they believe. The tool is designed to work on the “really low end” of embedded devices, which tend to have low computing power, Goffart explained.
“There are different levels of embedded: there are very cheap microprocessors that can only run compiled code and don’t have much memory, there are high-end embedded, and sometimes even more powerful. [than]… a personal computer,” he said. “We’ve scaled up to the point where we can support any computer that can display a user interface that isn’t quite perfect or has hardware acceleration.”
On the high-end embedded side, the tool “can easily support JavaScript,” he said. In fact, some in the industry are putting browsers on embedded systems and using JavaScript, he added. So it made sense for the Slint team to use JavaScript, but it didn’t add load to the browser.
why desktop?
Today, Goffart says, the trend is to use the browser as the basis for creating Web pages that behave like desktop applications. For Slint, the team wanted a native-like user interface on the desktop.
“We want to provide a way to create a user interface that the browser doesn’t have, meaning it’s native and looks like a real application for your computer, not a website,” Goffart said. said. “We believe native styles are important to ensure that all controls look like operating system controls.”
The tools team is now focused on what developers need to create UIs.
Simon Hausmann, co-founder of SixtyFPS GmbH, said: “You either set yourself a task or [your] Make it as easy as possible for developers to implement features as quickly as possible. Sure, it should be easy to use and look good, but don’t stress too much on the design side. ”
In the future, that may change. Their plan is to make Slint a tool that designers can use alongside developers.
“We want to target designers as well as software developers. We focus on products that are embedded devices so that designers and software developers can work together more easily. [or] For example, an application that runs on a laptop,” Goffart said.
Slint is dual licensed. This means that the developer can be licensed under the GPL version 3, an open source license, or a proprietary his license that allows the use of her Slint in products whose owner does not want to release the source code. Proprietary licenses are available by purchasing a copy or by joining Slint’s Ambassador Program. Developers exchange free proprietary licenses to brand apps built with Slint. Competitors include the free product Hausmann previously worked on and his QT.