title: Promise.resolve().then vs setImmediate vs nextTick
body: <p>NodeJS 0.11 as well as io.js and the Node 0.12 branch all ship with native promises.</p>
  
  <p>Native promises <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" rel="noreferrer">have a <code>.then</code> method</a> which always executes on a future event loop cycle. </p>
  
  <p>So far I've been using <code>setImmediate</code> to queue things to the next iteration of the event loop ever since I <a href="https://stackoverflow.com/questions/15349733/setimmediate-vs-nexttick">switched from nextTick</a>:</p>
  
  <pre><code>setImmediate(deferThisToNextTick); // My NodeJS 0.10 code
  process.nextTick(deferThisToNextTick); // My NodeJS 0.8 code
  </code></pre>
  
  <p>Since we now have a new way to do this:</p>
  
  <pre><code>Promise.resolve().then(deferThisToNextTick); 
  </code></pre>
  
  <p>Which should I use? Also - <strong>does <code>Promise.resolve.then</code> act like <code>setImmediate</code> or like <code>nextTick</code> with regards to code running before or after the event loop?</strong></p>