3 ms·
I think at this point the metaphor of "function coloring" has been overused, and we should use the real name: monadic async. The problem is obvious when you loo
by Zababa 5y ago
I think at this point the metaphor of "function coloring" has been overused, and we should use the real name: monadic async. The problem is obvious when you look at what a monad is: you have lots of ways in, but no way out. So every monad has to offer their specific way out, if they can. With a Option<T>, you can extract the value inside your function with unwrap. Your function will still be a regular function. With async, you can do the same with await. However, await can only be used inside async functions. That's the trap right there. The way to get out of the async monad is only usable inside the async monad.