this post was submitted on 07 Oct 2026
24 points (100.0% liked)

Rust

8317 readers
9 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[โ€“] SorteKanin@feddit.dk 10 points 2 days ago (1 children)

So basically their argument is that the missing piece is anonymous sum types. I tend to agree! It would be amazing to have that as a language feature, i.e. Result<(), FooError | BarError>. Unfortunately that is unlikely to arrive to the language for a loooong time... But I think I will definitely try out this library in the meantime.

[โ€“] BB_C@programming.dev 2 points 1 day ago (1 children)

A language feature is not needed because macros exist.

I would even argue that perhaps the most important role macros play is blocking adding endless language features ๐Ÿ˜‰

[โ€“] SorteKanin@feddit.dk 2 points 1 day ago (2 children)

Macros are often not very ergonomical to use compared to language features.

Also, why anonymous product types but not anonymous sum types? It seems kind of weird to me. Anonymous sum types can be just as useful as anonymous product types, as the blog post illustrates quite well I think.

[โ€“] BB_C@programming.dev 2 points 1 day ago

The language wouldn't have lost much without tuples actually. But they do at least have direct pattern destructuring utility. Anonymous enums don't.

They also don't pose potential future awkwardness if/when variant types become a thing.

[โ€“] TehPers@beehaw.org 2 points 1 day ago* (last edited 1 day ago)

While I agree with you that anonymous sum types are useful, the language designers tend to avoid anything that might include a hidden cost (in this case either the size of the enum or cost of boxing). Something along those lines might end up in the language eventually, though.