The next major release of Svelte, the increasingly popular web application framework, could benefit from improved performance and security for the Rust programming language, according to its creator. Rich Harris.
Among the possible changes for the eventual release of Svelte 4.0 is a new compiler, written in Rust, Harris said in a video interview produced by web development tools provider Vercel, where Harris is currently employed.
Despite Svelte’s potential performance improvements, Harris has heard complaints about very large code sizes resulting from very large web applications. Svelte compiles code for large web apps, for example, tends to be larger than component code for a similar app rendered in React. “It’s something that people are concerned about,” Harris said.
A Rust-based approach to complicating code could potentially “not only eliminate this problem, it could actually mean that the compiled code is smaller than the input code, which I think would be quite unique,” he said. Harris said. (Harris didn’t specify how the browser would interpret Rust code, although WebAssembly can provide an efficient delivery mechanism.)
Although a bit difficult to learn, the Rust language is quickly adopted by system designers, not only for its fast performance, but also for its security checks. To that end, Harris noted that a move to Rust “potentially opens the door to the limits of error.”
Catching up with React
The core team is also researching a number of other potential improvements, including the integration of React server components and the incorporation of “partial hydration approaches. “
Harris also wants to continue exploring Svelte’s medium for rendering movement. “It’s something Svelte has always prioritized,” Harris boasted. Svelte has declarative transitions to make it easier to add or remove an item from the browser’s Document Object Model (DOM). “We will not be removing the item from the DOM immediately. We can play a transition in it so that you get a graceful sliding, exiting, entering and exiting behavior, ”he said.
Despite these advanced features, Harris envies React’s Framer Motion library for producing animated layouts. “I think if a framework treated these things as its domain, then you could do a really nice UI design with very minimal effort,” he said.
The current version of Svelte (v3) was released in April 2019, and new versions are arriving every year and a half or so. The release date for Svelte 4.0 has yet to be publicly set.
Find the full interview here: