Pondering about a future with async/await

concurrency
off-topic

(Morten Bek Ditlevsen) #1

In Swift we have the rethrows keyword to signal that a function will be throwing in case it is passed a throwing function.

In the future we may get async / await - as explored in the Concurrency in Swift: One approach document.

Could you then imagine a keyword similar to rethrows with the meaning that a function will become async in case it is passed an async function? Is there prior art for such a reasyncs functionality?

Just a thought... :slight_smile:


(Joe Groff) #2

Yeah, this is a general property of things that can be treated as effects. Along these same lines, if we introduced pure functions, we could also have "re-impure" functions that are as pure as their closure arguments, and likewise for compiler-evaluable and other transitive concepts. It's a lot of complexity, but I think it would be good to turn this all into a formal effect system of some form eventually.


(Morten Bek Ditlevsen) #3

Wow, now I sort of get what is meant by an ‘effects system’ - thanks!
Thanks for the explanation! Sounds like the concept of pure functions could provide some huge optimization possibilities for function composition.