3 ms·
The problem with delegate/callback patterns with API calls is that you end up having to preserve a lot of state manually, which can be an error-prone process. A
by potatolicious 13y ago
The problem with delegate/callback patterns with API calls is that you end up having to preserve a lot of state manually, which can be an error-prone process. Any metadata associated with a request must be persisted (and then read back) in painstakingly manual fashion with a delegate pattern, whereas with async (or closures, or...) this information is trivially available on your stack.
The nice thing about async vs. typical closures is that it neatly avoids a lot of nested scopes.