> I'm going to claim that the latter method of returning a new task promise > is the one we should use in general. It makes the function more easily > usable outside of a task since you're just getting a promise back. It is > also what Task.jsm does internally for generators anyway.
I fully agree with Dave. On 10/8/13 9:06 PM, Marco wrote: > I usually prefer writing functions called by tasks as generators, > because it makes the code a little more readable (it avoids indentation). > It also makes the function impossible to use outside of a Task, so > people in future will not be able to just call it and forget that it's > asynchronous. > If someone wanted to use the function outside of a task, they'd just > need to add the "Task wrapper". I actually believe that it's quite easy to forget adding the Task wrapper and end up with something wrong. Cheers, David -- David Rajchenbach-Teller, PhD Performance Team, Mozilla _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform