News for hackers. Stuff that matters.
Re:Evergreen: A Provably Safe Systems Language by TofuLover on Wednesday November 04, 2026 @11:02AM (#50367519)
Is this just "Rust with dependent types"? Not saying that as a criticism, I think this is genuinely useful.
Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @11:10AM (#50367634)
Dependent types are part of it, yeah! There are definitely some things I dislike about Rust which I am not planning on including, mainly lifetimes and some ways they handle pointer mutability. One thing I particularly dislike about Rust is:

let x = vec![1,2,3]; let a = &mut x[0]; let b = &mut x[1]; swap(a, b);

This is not allowed. And actually in the compiler’s mind it’s for the same reason as this:

let x = vec![1,2]; let a = &mut x[0]; x.push(3); a = a + 1;

Which is definitely not safe and should be rejected. But the compiler cannot reason that the above case is actually safe, because they both fail to compile for lifetime reasons.

Another thing I’m working on are “patterns” which are like enums on steroids. In Rust you cannot define how an enum is laid out, thus requiring optimizations for types like Option<&T> to be in the compiler. In evergreen this will be in the language via a similar process to trait implementation.

Re:Evergreen: A Provably Safe Systems Language by nicce on Wednesday November 04, 2026 @11:14AM (#50367692)
> not planning on including, mainly lifetimes and some ways they handle pointer mutability

How are you going to solve the problem with other means? Lifetimes basically guarantee, that there are no use-after-free bugs.

Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @11:27AM (#50367936)
The compiler statically tracks “where” everything lives. It also knows “when” the “where” is valid.

Each “where” is called a plane, which is a tree. The stack plane contains all your function calls memory, a structure allocated on the stack has a child plane for each field. The compiler tags which plane something is from at compile time and tracks when it dies.

Things do get complicated in scenarios like:

fn max(a: &usize, b: &usize) -> &usize {

  if *a > *b { a } else { b }
}

In such a scenario the compiler tags the result with both of the input planes. However, you cannot define add a postcondition ensures clause to make it more precise

Re:Evergreen: A Provably Safe Systems Language by 0c3ca83 on Wednesday November 04, 2026 @12:00PM (#50368424)
And what about allocations and threads?
Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @12:06PM (#50368494)
Allocations live in their own plane, the root allocated typed being the root node of that plane. For threads, I’m still working on that, don’t have a super cool answer yet
Re:Evergreen: A Provably Safe Systems Language by 0c3ca83 on Wednesday November 04, 2026 @12:20PM (#50368656)
how does that prevent use after free? pretty sure your algorithm doesnt' actually work.
Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @12:32PM (#50368808)
The compiler tracks all of the currently living planes. The compiler tracks from which plane each borrow is borrowed. Once the plane it is borrowed from dies that borrow is no longer valid
Re:Evergreen: A Provably Safe Systems Language by 0c3ca83 on Thursday November 05, 2026 @09:05AM (#50379214)
If you can replace elements in a vector you can make elements unreachable.
Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @12:40PM (#50368929)
Another thing - when a value is moved or dropped the plane’s type changes from T to shape(T). shape(T) contains unspecified data but has the size and alignment of a T. So you couldn’t safely prove that a moved out/dropped shape(T) is a T
Re:Evergreen: A Provably Safe Systems Language by 0c3ca83 on Wednesday November 04, 2026 @02:15PM (#50370206)
This only works if you make every allocation its own plane, and scope all borrows to the lifetime of the plane, at which point this is equivalent to rust.
Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @03:48PM (#50371280)
Correct, every allocation is its own plane. The nice thing about this model is that you don't need to explicitly call out lifetimes. I also believe that lifetimes aren't really a good model of what actually happens in memory. This model is more powerful because it understands relationships between planes in memory, which Rust's model doesn't. This is why it requires mutable borrows to be unique which is oftentimes overly restrictive. For instance this is not valid Rust:

let x = vec![1, 2, 3]; let a = &mut x[0]; let b = &mut x[1]; swap(a, b);

Because Rust doesn't really know the difference between the whole Vec an element within the vec. Therefore it treats any mutation as one that could potentially invalidate anything with the same lifetime and doesn't compile. So I believe the plane model to be strictly better because it allows for this and still prevents the real scary thing:

let x = vec![1, 2]; let a = &mut x[0]; x.push(3); a = a + 1;

Re:Evergreen: A Provably Safe Systems Language by 0c3ca83 on Wednesday November 04, 2026 @06:00PM (#50372649)
How about `x[i] = 7`? What if x is a vector of values that contain allocations?
Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @06:39PM (#50372969)
I’m not quite sure I understand your question. But if x is a vector of things that contain allocations, the compiler will track a plane for them and represent them sparsely as needed be.
Re:Evergreen: A Provably Safe Systems Language by tancop on Wednesday November 04, 2026 @12:03PM (#50368464)
Sounds a lot like group borrowing from Valen, but that one still has annotations like `entity in world.entities[] mut`. Are you tracking the same things implicitly with post conditions?
Re:Evergreen: A Provably Safe Systems Language by throwaway17_17 on Wednesday November 04, 2026 @11:25AM (#50367905)
Since you are replying, I’ll go ahead and you answer…

In a sibling comment I said the types seem more likely to be refinement (or Liquid) types instead of being full-spectrum dependent types. Is this correct? I certainly haven’t been through enough of the docs to be confident, but I took a swing when I posted my comment.

Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @12:34PM (#50368851)
What I’ve showcased is definitely not full fledged dependent types. Support is planned via ideal generics but it’s lower on the priority list to nail down
Re:Evergreen: A Provably Safe Systems Language by throwaway17_17 on Wednesday November 04, 2026 @11:19AM (#50367790)
The introductory examples look more like refinement type (or Liquid types) which are limited to those operations and restrictions one’s that are provable by the compiler utilizing a restricted subset of operations and computational constructs subject to deterministic proving via SAT solving. I’m going to look closer at the docs so I could be mistaken on that point. It certainly seems to have taken the ownership and ‘borrowing’ concepts for memory semantics from Rust at a quick glance at the first few pages.
Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @11:22AM (#50367851)
Dependent types can be achieved via “ideal Generics”. Very undocumented and not ready to commit to how they work yet, but the basic idea is that a type can be generic on a value.
Re:Evergreen: A Provably Safe Systems Language by ch4s3 on Wednesday November 04, 2026 @11:24AM (#50367885)
How long have you been working on this?
Re:Evergreen: A Provably Safe Systems Language by jordan_bonecut on Wednesday November 04, 2026 @11:31AM (#50367990)
I have been building little prototype languages for years. This iteration which is heavily AI powered is a couple weeks old
Re:Evergreen: A Provably Safe Systems Language by ch4s3 on Wednesday November 04, 2026 @11:40AM (#50368138)
Oh cool, it's amazing how quickly you can stand up a language now, I love it. I'd love to exchange ideas, I really like what you're doing.

How are you doing resolution of your dependent(refined?) types? I've been using Z3, but you're clearly doing something else here.

Re:Evergreen: A Provably Safe Systems Language by ch4s3 on Wednesday November 04, 2026 @11:24AM (#50367872)
Yeah it definitely looks like refinement vs actual dependent types. I do the same thing here[1] in my language (pardon the mess). Adding liquid types to basically rust is IMHO a good idea.

[1] https://march-lang.org/docs/refinement-types/