On Mon, Feb 7, 2011 at 10:04 AM, Jerry Chen <[email protected]> wrote: > > As long as the abstraction doesn't create weird race conditions, nor forces > us to modify each driver for async stuff to work, I would be okay with this > capability. I just can't wrap my head around how one would test for > correctness and stability.
I believe it would. You now need to track what requests you have out and call the appropriate callback, a very difficult (and tedious task). A supposedly stateless library just inherited a /lot/ of state. Anecdote: I solved this problem for the Linode iPhone app. If you're not familiar with UIKit/Foundation development for iOS, it's all asynchronous. I spent very many hours debugging the code that did the linkage between APIRequest instances and the callback event on them. It got so difficult to do properly with Apple's APIs that I eventually stumbled upon a hopelessly inelegant solution: every request the iPhone app makes is a batch, with a test.echo action containing an ID which is a key into the pending-requests dictionary. Seriously. That's what asynchronous ends up becoming in a request-receive environment. It's a rabbit hole of inelegant solutions and a lot of tedious state tracking in the library. -- Jed Smith [email protected]
