r/rust • • Nov 17 '22

What are Rust’s biggest weaknesses?

What would you say are Rust’s biggest weaknesses right now? And are they things that can be fixed in future versions do you think or is it something that could only be fixed by introducing a breaking change? Let’s say if you could create a Rust 2.0 and therefore not worry about backwards compatibility what would you do different.

220 Upvotes

390 comments sorted by

View all comments

Show parent comment

3

u/rosefromthedead_ Nov 18 '22

I remember a similar comment on my original announcement post, but I never got my head around what it means. In effing-mad, functions marked with #[effectful] return a generator that can be driven with effect handlers to completion. Similarly, async fns return a future that can be driven by an executor to completion. What's the difference? They're both a regular fn(stuff) -> things, if that's what you mean.

Perhaps the documentation is misleading? It seems to me that effing-mad is already how you want it to be.

In general, I want to understand these things! My goal is to design the ideal API so that we can say with certainty whether such a system can cleanly bring benefits to Rust. So, if there are any more ideas out there of what people want from it that hasn't been considered yet, I'm all ears :)

6

u/zesterer Nov 19 '22

Oh, interesting! So the macro annotations on the function apply just to the return value and not to the calling of the function itself? That's good to know.

It would be nice if this were made clearer syntactically. Given that procedural macros can entirely transform token streams, may I suggest something like this?

#[effectful]
fn foo() -> Io + Yield<String> ~ i32 {
    ...
}

Obviously, one complication is that it doesn't mesh too nicely with regular type annotations, and I'm not sure how you'd work around that while being confined to working Rust.

4

u/rosefromthedead_ Nov 19 '22

You know, that's a great idea. It aligns better with syntax in other languages too (Haskell and Koka come to mind, but I'm sure there are many more). Thanks for mentioning it :)