Promises are asynchronous, which means it's not actually recursive calls; it's more like a loop. A simple example of this is the following, which isn't recursive either.
function send(buffers){
buffers.shift();
if (buffers.length) {
setTimeout(send.bind(null, buffers), 10);
}
}
send(buffers);
When we call send
, it shifts a buffer, and then maybe registers a timeout, and then returns. Because it returns without calling itself, it's not recursive.
side note: With ES6, there's proper tail call optimization; which means recursion limits won't be a problem as often.