For a cleaner comparison we should avoid unnecessary differences in the code. Let's fix that:
getTweetsFor("swannodette")
.then(function (tweets) {
return expandUrl(parseUrls(tweets)[0]);
})
.then(httpGet)
.then(
function (responseBody) {
console.log("Most recent link text:", responseBody);
},
function (error) {
console.error("Error with the twitterverse:", error);
}
);
Besides yield, ES6 has shorter function expressions (you can try them right now in Firefox): getTweetsFor("swannodette")
.then(tweets => expandUrl(parseUrls(tweets)[0]))
.then(httpGet)
.then(responseBody => console.log("Most recent link text:", responseBody),
error => console.error("Error with the twitterverse:", error));
I'd agree that this could be better still; I'd like either built-in syntax dealing with promises, like E had 15 or so years ago, or something more general like Haskell's do-notation. But yield seems nice too.