Some guidelines for the usage of suspending functions instead of async functions are as follows:
The list below uses Job to refer to implementations of it, including Deferred<T>.
- Generally, it is advised to use suspending functions over async functions to avoid tying the implementation to a Job.
- Always use suspending functions when defining an interface. Using async functions will force the implementation to return a Job.
- Likewise, always use a suspending function when defining an abstract function.
- The more visible a function is, the more important it is to use suspending functions: as already explained, you don't want to be forced to deprecate your public API because the implementation will be ...