Introducing Stainless
I've been working on something for a while now that I haven't really talked about here, so it's about time. It's called Stainless, and it's a programming language.
The short version is that it's C#'s syntax on top of C's memory model. It compiles to native code through LLVM, lays out its types exactly like C does, and can call into C (or be called from it) with no wrapper layer in between. Instead of a garbage collector it uses reference counting, so objects are cleaned up the moment nothing points at them anymore. And there are no header files: the compiler reads the whole program up front, so you declare something once and use it anywhere.
If you know C#, most of this should look familiar:
module Points;
import Standard.Console;
record Point(int X, int Y);
String Describe(Point p) => p switch
{
(0, 0) => "the origin",
{ X: 0 } => "on the Y axis",
(var x, var y) when x == y => "on the diagonal",
_ => $"somewhere else ({p.X}, {p.Y})"
};
int Main()
{
Point[] points = [new(0, 0), new(0, 5), new(3, 3), new(4, 1)];
foreach (var p in points)
Console.WriteLine(Describe(p));
return 0;
}
Records, pattern matching, collection expressions, target-typed new, generics, lambdas and properties are all there. A few things are different on purpose: there are no exceptions (errors are Result values instead), there's no async/await (it has parallel and spawn), and lambdas capture by value.
The part I'm proudest of is that it's built out of itself. The standard library, a GUI framework with Win32 and GTK back ends, and an IDE with a form designer and a debugger are all written in Stainless. If the language couldn't handle a real program, I'd have found out pretty quickly.
It's still experimental, it's still changing, and it's just me working on it, so don't go shipping anything important with it yet. That said, there are builds for Windows and Linux on the releases page if you want to try it. You'll need clang installed, and the README walks you through the rest.
Everything's up on GitHub: github.com/xeons/stainless
If you give it a try, I'd love to hear what you think.

