Rewriting Rust: A Response | Gavin D. Howard

submited by
Style Pass
2024-09-27 15:00:25

Before I do, in order to avoid misunderstandings, I must admit that I am not completely certain that these ideas are possible. More on that later.

First of all, function traits require Restricted Structured Concurrency (RSC), so if you’re looking for a catch, that is one of them.

The second catch is that every function trait needs to be restrictive. For example, pure is a restrictive trait because it restricts the function from having side effects. On the other hand, async is not restrictive; it actually allows the function to do more.

Why does this matter? Because a function without pure will always be able to call a function with it, while a function without async cannot just call a function with it.

This is actually the root of the function color problem: async is exactly backwards! Instead of marking asynchronous functions, languages should have had us mark synchronous functions, and then async should have been the default!

Although that wouldn’t remove the possibility of bugs when calling a blocking function in async code, which is the real reason I hate async.

Leave a Comment