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' designs!
Easy | Safe | Fast | |
---|---|---|---|
C++ | No | No | Yes |
Javascript | Yes | Yes | No |
Rust | No | Mostly | Yes |
Vale | Yes | Yes | Yes |
This article is meant to explain our vision for Vale, so will reference a lot of the final designs. We'll make it clear when we're talking about the current implementation versus what we have planned.
We hope to have all of these completed and benchmarked by late 2023. We're grateful for your interest and support as we create all this!
We picked these three languages because they're our favorites in some way:
This post is not meant to criticize, just an honest comparison. Also note that these are only 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.
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 impose the mutability-xor-aliasability restriction on every object, which is the source of Rust's difficulties.
Vale also has some innovations to make parallelism and concurrency easier:
Vale does make a few concessions here:
In the end, Vale is almost as easy as Javascript, and much easier than Rust and C++.
This principle is called "gradual complexity." Other languages that do this well are C#, Swift, and Go.
Vale is 100% memory-safe and data-race-safe, like Javascript, and safer than Rust and C++.
Vale plans to have a memory-safe unsafe block, as odd as that sounds; it will use the region borrow checker to keep the safe region's data separate from the unsafe region's data, and allowing safe communication between them.
Vale's "check override" operator !! is disabled by default, and can be enabled on a per-module basis.
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 and C++ in the average case, and much faster than Javascript.
It is of course impossible to match C++'s speed in theory. However, for the majority of programs, Vale could approach it, and sometimes even surpass it.
Basically, we start with Generational References, and then remove the vast majority of the generation checks by using:
By our estimation, a surprisingly high percentage of functions drop to zero memory-safety overhead when we use these three techniques together as in this snippet, and we estimate the remaining generation checks are only about as common as the extra bounds checking that Rust does compared to other languages.
Additionally, Vale aims to make fast patterns much more accessible than C++ does, by:
If we can make it easier to use these performance techniques, then people will use them more, and their programs will be faster in practice.
In summary, while no language can be faster than C++'s speed in theory, the average Vale program might be much faster in practice.
On top of all that, if there's still a generation check in critical code and someone needs an extra sliver of speed, they can use the check override operator to elide that check in release mode.
Vale, C++, Rust, and JS have different strengths which makes them excel in different use cases.
Compared to Vale:
Vale's combination of speed, safety, and ease are universally useful, but it will particularly shine for:
We hope you enjoyed this article, and as always, feel free to tweet us, leave any comments in the r/vale subreddit, or swing by our discord server!
If you're as excited about Vale as we are, please consider sponsoring us!
The borrow checker influences our programs to put more objects into centralized Vecs and HashMaps, which incur more bounds checking and hashing costs than other languages would in the same situation.
Vale aims to bring a new way of programming into the world that offers speed, safety, and ease of use.
The world needs something like this! Currently, most programming language work is in:
These are useful, but there is a vast field of possibilities in between, waiting to be explored!
Our aim is to explore that space, discover what it has to offer, and make speed and safety easier than ever before.
In this quest, we've discovered and implemented a lot of new techniques:
These techniques have also opened up some new emergent possibilities, which we hope to implement:
We also gain a lot of inspiration from other languages, and are finding new ways to combine their techniques:
...plus a lot more interesting ideas to explore!
The Vale programming language is a novel combination of ideas from the research world and original innovations. Our goal is to publish our techniques, even the ones that couldn't fit in Vale, so that the world as a whole can benefit from our work here, not just those who use Vale.
Our medium-term goals:
We aim to publish articles biweekly on all of these topics, and create and inspire the next generation of fast, safe, and easy programming languages.
If you want to support our work, please consider sponsoring us on GitHub!
With enough sponsorship, we can: