Vale was created to be the first fast, safe, and easy programming language.
Generally, languages today have one or two, but not all three.
This article will dive into the details and compare these languages.
Note that Vale is not finished, it's only at v0.1. We make it clear in the asides when we're talking about the design, rather than the implementation.
Easy | Safe | Fast | |
---|---|---|---|
C++ | No | No | Yes |
Javascript | Yes | Yes | No |
Rust | No | Mostly | Yes |
Vale | Yes | Yes | Yes |
Keep in mind, this article is written with love; I picked these three languages because they're my favorite in some way:
This post is not meant to be a hit piece, just an honest comparison. Also note that these are just my opinions, and not objective truths!
(I hope this isn't quoted on PCJ!)
It's fun to push the borrow checker's boundaries, especially when traits and closures are involved!
Vale aims to be safe and fast while also remaining easy. 2
To get a sense of what easy means:
Vale is 100% safe, which removes most of C++'s difficulties.
Vale's region borrow checker doesn't have the mutability xor aliasability restriction, which which is the source of Rust's difficulties.
Vale makes a few concessions here:
In the end, Vale is almost as easy as Javascript, and much easier than Rust and C++.
Vale is still v0.1 (a prototype), and its tooling (compiler, debugging, IDE support, etc.) is very young. This section factors in only the languages themselves.
This principle is called "gradual complexity." Other languages that do this well are C#, Swift, and Go.
Vale is 100% safe, like Javascript, and much safer than Rust and C++.
Vale has no unsafe, and uses extern isolation to make it so bugs in C code can't trigger memory unsafety in Vale code. You can read more about this at Absolute Safety in Vale.
Specifically, Javascript can use FFI into other languages with webassembly, but it doesn't share memory with them, it only sends immutable values back and forth.
This stands for Foreign Function Interface, and refers to how Rust can call into C code.
Vale aims to be as fast as Rust, almost as fast as C++, and much faster than Javascript. 6
Vale's hybrid-generational memory uses generational references and scope tethering to make very fast code, with very little run-time overhead. 8
Vale also uses regions to make it much easier to harness alternate allocation strategies.
In practice, Vale could be:
For more thoughts on Rust and Vale (and other languages), check out Beyond Rust: Innovations in Safety, Speed, and Flexibility!
It's important to keep in mind that Vale, C++, Rust, and JS have different strengths which makes them suitable for different use cases.
Compared to Vale:
Vale's combination of speed, safety, and ease are universally useful, but it will particularly shine for:
I hope you enjoyed this article, and as always, feel free to leave any comments in the r/vale subreddit or swing by our discord server!
Until we finish HGM and have benchmarks, this is a goal, not a claim.
See Beyond Rust: Innovations in Safety, Speed, and Flexibility for more on the borrow checker's indirect run-time overhead.
This is still being implemented, but you can read about the design at Hybrid-Generational Memory!
This behavior keeps single ownership and move semantics easy.
One can override this with the inl or yon keywords for a specific allocation. (yon is a temporary name, we're still weighing better keywords.)
Vale could have a file- or function-level compiler directive to require inl or yon keywords on every allocation.
Vale instead uses FFI to call into another language (such as C, C++, or Rust) to do the low-level operations for it.
With regions, it could be faster than C++ in some cases.
See Seamless Speed, Safety, and Reuse Without Frameworks for more on the apps case.