Enhanced Asset API

Agreed that yield and all of the ability to do coroutines is great - already doing a lot of that server side in NodeJS iojs etc, much more attractive - and of course that would give us coroutines in PlayCanvas which is a good thing. Exception handling with generators is also very nice. Of course generators work extremely well when you yield a promise or a hard value and the built in support in Q and Bluebird for handling these in function* routines is superb.

To your points:

  1. I never use objects with multiple keys personally, never found the need. Closures cover cases where you really must do things in sequence without consuming the previously returned value and I find these rare, leading to point 2:

  2. Using .all/.when/.spread or whatever on your promise library provides a way of getting multiple results to the .then and leads to more parallel code (with callbacks developers rarely call two at the same time, even if they are both async and potentially parallel).

  3. Promise library long stack traces, Chrome’s ability to debug async remove all of this for me. In fact my error handling ends up being only a few .fails

  4. If I compare code that my developers have built that has been switched to use promises it is shorter, more parallel and more legible.

I believe I mentioned that I would be promisifying the asset loader, it’ll probably be 3 lines of code if I use Bluebird :slight_smile: