Top
Best
New

Posted by ingve 1 day ago

Rue: Higher level than Rust, lower level than Go(rue-lang.dev)
Related: https://steveklabnik.com/writing/thirteen-years-of-rust-and-...
242 points | 245 commentspage 2
dpflan 21 hours ago|
Just pointing out here that "rue" is used to express "to regret", emphatically. Perhaps it is not the best name for a programming language.
steveklabnik 21 hours ago||
That’s part of the reason for the name! “Rust” also has negative interpretations as well. A “rue” is also a kind of flower, and a “rust” is a kind of fungus.
dpflan 20 hours ago||
Fair enough! I do like how others are framing this is as "write less code" -- if Rue makes one think more and more about the code that finally makes it to the production, that can be a real win.
embedding-shape 21 hours ago|||
Sounds fitting to me. Every line of code I wrote that ultimately didn't need code to begin with, is basically codified regrets checked into git.
9rx 21 hours ago||
The best code is the code not written, so perhaps it is the best name for a programming language?
yoan9224 20 hours ago||
The positioning is interesting - claiming Rust's performance with Go's simplicity is basically every new systems language's promise since 2015. The key differentiator seems to be "zero-cost exceptions" which I assume means compile-time Result types without runtime unwinding overhead? That's compelling if true, since Rust's Result ergonomics can get verbose in deeply nested error chains.

But the real test is compile times and cognitive overhead. Rust's borrow checker is theoretically elegant but practically brutal when you're learning or debugging. If Rue can achieve memory safety without lifetime annotations everywhere, that's genuinely valuable. However, I'm skeptical - you can't eliminate tradeoffs, only move them around. If there's no borrow checker, what prevents use-after-free? If there's garbage collection, why claim "lower level than Go"?

The other critical factor is ecosystem maturity. Rust's pain is partially justified by its incredible crate ecosystem - tokio, serde, axum, etc. A new language needs either (1) seamless C FFI to bootstrap libraries, (2) a killer feature so valuable that people rewrite everything, or (3) 5+ years for the ecosystem to develop. Which path is Rue taking?

I'd love to see real-world benchmarks on: compile time for a 50k line project, memory usage of a long-running web server compared to Rust/Go, and cold start latency for CLI tools. Those metrics matter more than theoretical performance claims. The "fun to write" claim is subjective but important - if it's genuinely more ergonomic than Rust without sacrificing performance, that could attract the "Python developers wanting systems programming" demographic.

steveklabnik 18 hours ago||
I’m explicitly not claiming Rust’s performance. Rust will always be ahead here. I’m giving up some of that performance for other things.

I do agree that those benchmarks are important. Once I have enough language features to make such a thing meaningful, I’ll be tracking them.

Where did I write that it’s fun to write?

whimsicalism 19 hours ago||
Your style of commenting is pretty full of LLM tells fyi. Normally don’t comment on it but this is the second such comment of yours I have read in a few minutes.

e: I would be curious of the thoughts of those downvoting as personally I don’t think mostly LLM written comments are a direction we want to move towards on HN.

Hemospectrum 16 hours ago|||
Rather than downvoting you, I will speak up to say I don't see what you're seeing. Spaces around hyphens, yeah, sure, but LLMs prefer em dashes, and even that is unreliable, because it's borrowed from habits that real humans have had for many years.

For me, the more important indicator is the content. I see reports of personal experience, and thoughts that are not completely explained (because the reader is expected to draw the rest of the owl). I don't see smugly over-the-top piles of adjectives filling in for an inability to make critiques of any substance. I don't see wacky asides amounting to argumentum ad lapidem, accomplishing nothing beyond insulting readers who disagree with a baseless assertion.

I think it's likely you have drawn a false positive.

whimsicalism 16 hours ago||
It saddens me a bit that this can't be distinguished by people on here. I encourage you to take a look at their profile and see if you are still as skeptical. Noticing em-dashes is facile and as you mention, common among human written text - but there are more subtle stylistic cues (although now that you mention it, this writer likely went out of their way to replace emdashes with hyphens).

I was raised in a family of professional writer-editors (but now am the tech-y black sheep) which might make the cues a bit more obvious to me. The degree to which this style of writing was common prior to 2022 is vastly overstated, the tells were actually not really that common.

dkdcio 16 hours ago|||
A) you cannot tell B) you have said nothing productive toward discussion, you’ve just accused someone of using a tool (that you don’t know if they used)

I’d prefer actual criticism of the content. (I cannot downvote and would not if I could)

whimsicalism 16 hours ago||
I am certain that they used a tool. As I said, I normally do not complain and typically engage on the merits -- but these have been among the top comments on every front page article I've read today and it gets tiresome! To me, if you cannot invest enough effort to remove the pretty obvious cues, why am I investing the effort in reading the comment?

After seeing your reply, I looked at their comment history which makes it even more obvious imo.

dkdcio 15 hours ago||
that is fair —- you’re claiming this person has a pattern of lazy, low-effort comments. I didn’t check and if you’re right, I appreciate you calling it out

just as you’re annoyed by low-effort LLM posts/comments, I’m annoyed by low-effort “this sounds like it was written by ChatGPT” comments (hence my response and at least a possible explanation of downvotes)

edit: I also scrolled through, you’re absolutely right! it does look like a low-effort bot

metaltyphoon 11 hours ago||
What was the rationale to not use cargo? By the way, I really enjoy when you are a guest on the fallthrough podcast.
steveklabnik 11 hours ago|
Thanks!

So, one reason is "I just want to learn more about buck2."

But, for the first iteration of Rue, I maintained both. However, for a language project, there's one reason Cargo isn't sufficient now, and one reason why it may not later: the first one is https://github.com/rue-language/rue/blob/trunk/crates/rue-co... : I need to make sure that, no matter what configuration I build the compiler in, I build a staticlib for the runtime. With Cargo, I couldn't figure out how to do this. In test mode, it would still try to build it as a dylib.

Later, well, the reason that rustc has to layer a build system on top of Cargo: bootstrapping. I'm not sure if Rue will ever be bootstrapped, but rustc uses x.py for this. Buck does it a lot nicer, IMHO https://github.com/dtolnay/buck2-rustc-bootstrap

est31 1 day ago||
I have mostly been writing Rust in the last 10 years, but recently (1 year) I have been writing Go as well as Rust.

The typical Go story is to use a bunch of auto generation, so a small change quickly blows up as all of the auto generate code is checked into git. Like easily a 20x blowup.

Rust on the other hand probably does much more such code generation (build.rs for stuff like bindgen, macros for stuff like serde, and monomorphized generics for basically everything). But all of this code is never checked into git (with the exception of some build.rs tools which can be configured to run as commands as well), or at least 99% of the time it's not.

This difference has impact on the developer story. In go land, you need to manually invoke the auto generator and it's easy to forget until CI reminds you. The auto generator is usually quite slow, and probably has much less caching smartness than the Rust people have figured out.

In Rust land, the auto generation can, worst case, run at every build, best case the many cache systems take care of it (cargo level, rustc level). But still, everyone who does a git pull has to re-run this, while with the auto generation one can theoretically only have the folks run it who actually made changes that changed the auto generated code, everyone else gets it via git pull.

So in Go, your IDE is ready to go immediately after git pull and doesn't have to compile a tree of hundreds of dependencies. Go IDEs and compilers are so fast, it's almost like cheating from Rust POV. Rust IDEs are not as fast at all even if everything is cached, and in the worst case you have to wait a long long time.

On the other hand, these auto generation tools in Go are only somewhat standardized, you don't have a central tool that takes care of things (or at least I'm not aware of it). In Rust land, cargo creates some level of standardization.

You can always look at the auto generated Go code and understand it, while Rust's auto generated code usually is not IDE inspectable and needs special tools for access (except for the build.rs generated stuff which is usually put inside the target directory).

I wonder how a language that is designed from scratch would approach auto generation.

mxey 1 day ago||
> On the other hand, these auto generation tools in Go are only somewhat standardized, you don't have a central tool that takes care of things (or at least I'm not aware of it).

https://pkg.go.dev/cmd/go#hdr-Generate_Go_files_by_processin...

Kinrany 1 day ago|||
FYI rust-analyzer can show expanded macros. It's not perfect because you only get syntax highlighting, but it works.
steveklabnik 1 day ago|||
Yeah, this is a hard problem, and you're right that both have upsides and downsides. Metaprogramming isn't easy!

I know I don't want to have macros if I can avoid them, but I also don't forsee making code generation a-la-Go a first class thing. I'll figure it out.

beautron 1 day ago|||
> The typical Go story is to use a bunch of auto generation, so a small change quickly blows up as all of the auto generate code is checked into git. Like easily a 20x blowup.

Why do you think the typical Go story is to use a bunch of auto generation? This does not match my experience with the language at all. Most Go projects I've worked on, or looked at, have used little or no code generation.

I'm sure there are projects out there with a "bunch" of it, but I don't think they are "typical".

GeneralMayhem 23 hours ago|||
Same here. I've worked on one project that used code generation to implement a DSL, but that would have been the same in any implementation language, it was basically transpiring. And protobufs, of course, but again, that's true in all languages.

The only thing I can think of that Go uses a lot of generation for that other languages have other solutions for is mocks. But in many languages the solution is "write the mocks by hand", so that's hardly fair.

tgv 1 day ago||||
Me neither. My go code doesn't have any auto-generation. IMO it should be used sparingly, in cases where you need a practically different language for expressivity and correctness, such as a parser-generator.
lenkite 20 hours ago|||
Anything and everything related to Kubernetes in Go uses code generation. It is overwhelmingly "typical" to the point of extreme eye-rolling when you need to issue "make generate" three dozen times a day for any medium sized PR that deals with k8s types.
auggierose 23 hours ago|||
Auto generation? If you need to use that a lot, then the programming language is defective, I would say.
9rx 21 hours ago||
When Go was launched, it was said it was built specifically for building network services. More often than not that means using protobuf, and as such protobuf generated code ends up being a significant part of your application. You'd have that problem in any language, theoretically, due to the design of protobuf's ecosystem.

Difference is that other languages are built for things other than network services, so protobuf is much less likely to be a necessary dependency for their codebases.

nasretdinov 18 hours ago|||
What I've found over the years is that protobuf is actually not that widespread, and, given that, if you ignore gogoprotobuf package, it would generate terrible (for Go's GC) structs with pointers for every field, it's not been terribly popular in Go community either, despite both originating at Google
auggierose 21 hours ago|||
I'd say auto generation is just another instance of Greenspun's tenth rule.
ryanobjc 1 day ago||
The "just generate go code automatically then check it in" is a massive miswart from the language, and makes perfect sense because that pathological pattern is central to how google3 works.

A ton of google3 is generated, like output from javascript compilers, protobuf serialization/deserialization code, python/C++ wrappers, etc.

So its an established Google standard, which has tons of help from their CI/CD systems.

For everyone else, keeping checked-in auto-generated code is a continuous toil and maintenance burden. The Google go developers don't see it that way of course, because they are biased due to their google3 experience. Ditto monorepos. Ditto centralized package authorities for even private modules (my least fave feature of Go).

mxey 1 day ago||
> For everyone else, keeping checked-in auto-generated code is a continuous toil and maintenance burden. The Google go developers don't see it that way of course, because they are biased due to their google3 experience.

The golang/go repo itself has various checked-in generated repo

pjmlp 1 day ago||
If this language is supposed to be used for systems programming, doing a factorial isn't really a selling example of why Rue.
steveklabnik 1 day ago|
For sure. It's just such early days I don't have a lot of stuff that's useful yet. I'll get there.
reactordev 1 day ago||
I write a lot of go. I tried to write a lot of rust but fell into lifetime traps. I really want to leave C++ but I just can’t without something that’s also object oriented.

Not a dig at functional, it’s just my big codebases are logically defined as objects and systems that don’t lend itself to just being a struct or an interface.

Inheritance is why I’m stuck in C++ land.

I would love to have something like rust but that supports classes, virtual methods, etc. but I guess I’ll keep waiting.

scuff3d 1 day ago||
In Rust you can have structs with any number of methods defined on them, which is functionally not that different from a class. You get interface like behavior with traitsz and you get encapsulation with private/public data and methods.

Does inheritance really matter that much?

reactordev 1 day ago||
Yes it does. Unless I can attach a trait to a struct without having to define all the methods of that trait for that struct. This is my issue with interfaces and go. I can totally separate out objects as interfaces but then I have to implement each implementation’s interface methods and it’s a serious chore when they’re always the same.

For example: Playable could be a trait that plays a sound when you interact with it. I would need to implement func interact for each object. Piano, jukebox, doorbell, etc. With inheritance, I write it once, add it to my class, and now all instances of that object have interact. Can I add instance variables to a trait?

This saves me time and keeps Claude out of my code. Otherwise I ask Claude to implement them all, modify them all, to try to keep them all logically the same.

I also don’t want to go type soup in order to abstract this into something workable.

scuff3d 1 day ago||
You can provide default method implementations for traits. Any type with that trait gets the default behavior, unless you override it.
reactordev 23 hours ago||
But that trait can’t have fields
scuff3d 20 hours ago||
You can use a struct that the other structs have as a field. The trait can then operate on that struct.

I'm not trying to convince you to use Rust. If you prefer C++ have at it. I was just trying to point out that most patterns in C++ have a fairly close analogy in Rust, just with different tradeoffs.

reactordev 20 hours ago||
Yeah go has embedded structs. It’s ugly and allows one to address the fields on the parent and it exposes the struct (with the same fields) so it’s kind of a head scratcher.

To be honest, it’s been 3 years since I looked at rust and I might try again. I still prefer inheritance because some things just are-a thing. I also love ECS and components and see traits as that. I just wish I could store local state in those.

scuff3d 19 hours ago||
You can store state in the struct and then define a method in the trait to return the struct. Then all your default methods can use the "getter" to access the struct and it's state. The only thing you have to do is embed the struct and implement that one "getter" method to return it. I don't think it's much more boilerplate then utilizing inheritance.

Fyrox, a game engine written in Rust, uses an ECS and several object oriented patterns in their design. Might be a good reference if your interested. The rust book also has a section on OOP patterns in Rust.

I think it's Fyrox anyway. I remember the creator of a Rust game engine talking about it in an interview on Developer Voices. It could have been Bevy I guess, but I don't think so.

reactordev 18 hours ago||
Yeah that’s what I did and it’s ugly. It works, and allows me to attach multiple behaviors but I would have to initialize them and write that boilerplate code to return them.

I think I might be able to do it with a macro but I’m not a rust guy so I’m limited by my knowledge.

steveklabnik 1 day ago|||
I respect your preferences, but I am unlikely to add this sort of OOP. Ideally there'll be no subtyping at all in Rue. So you'll have to keep waiting, I'm afraid. Thanks for checking it out regardless!
amluto 1 day ago|||
As a long time C++ user, I’m curious why you like inheritance and virtual methods so much.

I maintain a medium sized, old-ish C++ code base. It uses classes and inheritance and virtual methods and even some multiple inheritance. I despise this stuff. Single Inheritance is great until you discover that you have a thing that doesn’t slot nicely into the hierarchy or when you realize that you want to decompose an interface (cough, base class) into a couple of non-hierarchically related things. Multiple inheritance is an absolute mess unless you strictly use base classes with pure virtual methods and no member variables. And forcing everything into an “is a” relationship instead of a “has a” relationship can be messy sometimes.

I often wish C++ had traits / or Haskell style type classes.

chuckadams 19 hours ago|||
Protected and private inheritance are C++'s equivalent to traits, and they don't suffer from the usual issues of multiple inheritance. As for type classes, check out concepts. By no means am I trying to sell C++, I don't touch it myself, but it doesn't leave you completely adrift in those seas.
amluto 12 hours ago||
> Protected and private inheritance are C++'s equivalent to traits

How so? Maybe in a COM-like world where the user of an object needs to call a method to get an interface pointer.

I’ll grant that concepts are a massive improvement.

xpe 1 day ago|||
Ah, yes, multiple inheritance in C++: where order matters but sanity does not
culebron21 18 hours ago||
Usually it takes some time to get used to borrow checker and lifetimes. After that, you stop noticing them.
tete 13 hours ago||
Looks nice, but -> syntax always feels extremely off-putting. What does it get me?
steveklabnik 13 hours ago|
I’m just copying Rust here because I care more about semantics at the moment. I may get rid of it, see some previous musings around this here https://steveklabnik.com/writing/too-many-words-about-rusts-...
waldrews 1 day ago||
What the world needs is a more expressive language than Go, that interops with Go's compilation model and libraries.
rubenvanwyk 1 day ago||
Something like Borgo https://borgo-lang.github.io/
jandy 1 day ago||
Sadly, seems to be abandoned. Last commit a year ago.
pjmlp 18 hours ago||
Nah, we already have that in D, C#, and who knows maybe one day Java finally gets Valhala, or one can use Kotlin or Scala in the meantime.
waldrews 6 hours ago||
It's amazing how often C# (or more broadly CLR/JVM) is the pragmatic answer, even when you feel uncool using it.
pjmlp 4 hours ago||
Indeed. :)
coffeeaddict1 1 day ago||
How does this differ from Hylo [0]?

[0] https://hylo-lang.org

steveklabnik 1 day ago|
I am very interested in Hylo! I think they're playing in similar spaces. I'd like to explore mutable value semantics for Rue.

One huge difference is that Hylo is using LLVM, whereas I'm implementing my own backends. Another is that Hylo seems to know what they want to do with concurrency, whereas I really do not at all right now.

I think Hylo takes a lot of inspiration from Swift, whereas I take more inspiration from Rust. Swift and Rust are already very similar. So maybe Hylo and Rue will end up like this: sister languages. Or maybe they'll end up differently. I'm not sure! I'm just playing around right now.

fuzztester 15 hours ago||
How are Swift and Rust very similar? I can search, but want to hear your opinion.

And congrats on starting a language project, even if Just for Fun (Linux). ;)

https://frappe.io/blog/book-reviews/just-for-fun-a-book-on-l...

steveklabnik 13 hours ago||
Thanks :)

Both are playing around in similar spaces, both shared team members for a while, both have a take an automatic memory management that isn’t a garbage collector, both were sponsored by a primary company for a while (Swift still is, I think). There’s a lot of differences too.

dingdingdang 23 hours ago|
Any tentative ideas yet as to how you will manage the memory management? Sounds like a sort of magic 3rd way might be in the making/baking!
steveklabnik 23 hours ago|
Something in the area of linear types and mutable value semantics.
dingdingdang 14 hours ago||
Anything out there for reference or would you be implementing from theory/ideas here? God speed to you in terms of the project overall, it's exciting to see the beginnings of a rust-like-lang without the headaches!
steveklabnik 13 hours ago||
Not implemented yet, I’m reading papers :)

Thanks!

More comments...