← Back to context

Comment by steveklabnik

3 days ago

I am playing around with this! I'm mostly interested in something in the space of linear types + mutable value semantics.

Also working on a language / runtime in this space.

It transpiles to Zig, so you have native access to the entire C library.

It uses affine types (simple ownership -> transfers via GIVE/TAKES), MVCC & transactions to safely and scalably handle mutations (like databases, but it scales linearly after 32 cores, Arc and RwLock fall apart due to Cache Line Bouncing).

It limits concurrent complexity only to the spot in your code WHERE you want to mutate shared memory concurrently, not your entire codebase.

It's memory and liveness safe (Rust is only memory safe) without a garbage collector.

It's simpler than Go, too, IMO - and more predictable, no GC.

But it's nearly impossible to beat Go at its own game, and it's not zero overhead like Rust - so I'm pessimistic it's in a "sweet spot" that no one will be interested in.

Time will tell.

  • can you share the link, sounds fascinating language to follow its development as well and good luck on this project!

  • Neat! Good luck, that sounds very cool. I have no idea what if anything I'm going to do about liveliness.

You might find one of my late brother's research interests relevant: https://www.cs.princeton.edu/~dpw/papers/space.pdf

  • Thank you for the link! I'll check it out for sure.

    (And sorry to hear about your brother's passing.)

    • Yeah, that's just one of the essays he was on as a phd student, but he was really interested in the interaction of linear types and region inferencing as a general resource management framework. That grew into an interest in linear types as part of logical frameworks for modeling concurrency. But then like a lot of people he became disillusioned with academia, went to make some money on wall street, then focused on his family after that.

      Anyhow, I just thought it might be a good jumping off point for what you're exploring.

Nice! I see you're one of (if not the primary) contributor!

Do you see this as a prototype language, or as something that might evolve into something production grade? What space do you see it fitting into, if so?

You've been such a huge presence in the Rust space. What lessons do you think Rue will take, and where will it depart?

I see compile times as a feature - that's certainly nice to see.

  • This is a project between me and Claude, so yeah :)

    It's a fun project for me right now. I want to just explore compiler writing. I'm not 100% sure where it will lead, and if anyone will care or not where it ends up. But it's primarily for me.

    I've described it as "higher than Rust, lower than Go" because I don't want this to be a GC'd language, but I want to focus on ergonomics and compile times. A lot of Rust's design is about being competitive with C and C++, I think by giving up that ultra-performance oriented space, I can make a language that's significantly simpler, but still plenty fast and nice to use.

    We'll see.

Could you please explain what this implies in layman's terms? I've read the definition of 'linear type' as a type that must be used exactly once, and by 'mutable value semantics', I assume, that unlike Rust, multiple mutable borrows are allowed?

What's the practical implication of this - how does a Rue program differ from a Rust program? Does your method accept more valid programs than the borrow checker does?

  • I’m on my phone on a long road trip, so I can’t really give you a good lengthy explanation right now, to be honest.

    Mutable value semantics means no references at all, from a certain perspective.

    You can sort of think of linear types as RAII where you must explicitly drop. Sorta.

    “More programs” isn’t really the right way to think about it. Different semantics, so different programs :)

Have you explored the ideas explored for the Vale language: https://vale.dev/

May be an interesting approach. That language seems very academic and slow moving at the moment though.

  • I think Vale is interesting, but yeah, they have had some setbacks, in my understanding more to do with the personal lives of the author rather than the ideas. I need to spend more time with it.

So linear type + mutable value would be quite close to Rust, right?

  • Rust has affine types, not linear. It also doesn't have mutable value semantics, it uses references, lifetimes, and borrowing.

    • I've never seen any significant difference in linear vs affine types.

      To me it just seems like Rust has Linear types, and the compiler just inserts some code to destroy your values for you if you don't do it yourself.

      I guess the only difference is that linear types can _force_ you to manually consume a value (not necessarily via drop)? Is that what you are going for?

      1 reply →