<div dir="ltr"><br><div class="gmail_extra">On Thu, Apr 4, 2013 at 11:47 AM, Dave Camp <span dir="ltr"><<a href="mailto:dcamp@mozilla.com" target="_blank">dcamp@mozilla.com</a>></span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>I think the problem some people have with non-deferred-promises is that given the following code:<br>
---<br></div>foo().then( ){<br></div> dump("1");<br></div><div> return nextTickPromise();<br>
</div>}).then(function() {<br></div><div> dump("2");<br></div>});<br><br></div><div>dump("3");<br></div><div>---<br></div><div><br></div><div>Whether you get "123" or "312" depends on the implementation of foo(). And if it's sync today, you have no guarantee that it will stay that way (like mconnor said - if you had such a guarantee you wouldn't be using promises). With async promises you can guarantee that order will be 321.<br>
</div></div></blockquote><div><br></div><div>You mean 312 right?<br></div><div><br></div><div>There are also two parts that we should be careful about conflating. One is whether calling then() on an already resolved promise will call the callbacks before then() returns. A+ says this should never happen and it alone would serve to ensure the order of events above is 312. The other part is whether resolving a promise returns before starting to call callbacks. Maybe that part is less of a concern.<br>
</div></div></div></div>