Hi Mark! Thanks for taking the time to read and reply!
I really don't have an aversion to using Promises at all! I'm trying to point out that continuation passing style async programming and Promises can co-exist. I love the way how Promises can be neatly combined with Generators and the semantics of the struct appeal to me as well. It's just the way Promises are required to be used in its current form as a library that bias me towards falling back to continuation passing style. I'd like to pass you one link that might tell you what I mean: http://mxr.mozilla.org/mozilla-central/source/toolkit/content/Task.jsm#191 This is the part of Task.jsm that developers using it in production code need to be very much aware of: all your code will be executed inside a try…catch block. Last time I checked that represented a potentially massive performance hazard, but please correct me if I'm wrong! (this doesn't mean I think Task.jsm sucks at all, I think it's a great little library which certainly has proven its use) About the unit tests: I'm not at all proposing to remove Promises from unit tests, far from it! My main point is about proposing to unify the structure of our tests and to promote reusability of code, whereas much test bootstrapping code is now duplicated across the various tests. The magic prefixes are simply for added convenience to the developer who is wary of using block comments to disable and/ or isolate tests temporarily. I might've explained that poorly! I merely wanted to point out we can do so much more to promote TDD-style development. Again, thanks for your time, Mike. On May 8, 2013, at 4:04 AM, Mark Hammond <[email protected]> wrote: > On 7/05/2013 11:49 PM, Mike de Boer wrote: >> TLDR; in bug 867742 I requested to adopt two JS modules, Async.jsm >> and AsyncTest.jsm, in mozilla-central/toolkit/modules. The whole >> story can be read below as well as at >> https://gist.github.com/mikedeboer/5495405. I posted about this >> subject before on firefox-dev: >> https://mail.mozilla.org/pipermail/firefox-dev/2013-April/thread.html#268 > > I don't see the advantage to this, even after re-reading that thread. It > seems like the biggest advantage is that it addresses *your* aversion to > using promises while ignoring the fact that promises and Task.jsm are being > used fairly extensively in our tests (and more and more in the production > code). To my mind, this alone makes your claim: > > | most of the unit tests are written in the same structure and b) are > | structured in such a way that they're easy to read by someone other > | than you. > > somewhat suspect - unless you are also proposing to remove promises from the > existing tests? Combine this with the non-obvious features such as magic > prefixes for the test descriptions and I'm concerned this would make the > cognitive overhead of understanding our tests worse rather than better. > > While I appreciate the sentiment and would always encourage discussions which > aim to make things better, I see more potential downsides than upsides in > this proposal. > > Just-my-2c ly, > > Mark
_______________________________________________ dev-platform mailing list [email protected] https://lists.mozilla.org/listinfo/dev-platform

