News for hackers. Stuff that matters.
Re:Side Effects vs. Promises by danmaz74 on Sunday October 04, 2015 @07:17PM (#10329203)
I read the OP's comment as: you can write the "then" functions as pure functions, and they won't have any side effects; those will then be isolated inside the code that resolves the promise - code that you usually don't write yourself as it is part of some library, as with "fetch(...)" for making an HTTP request.
Re:Side Effects vs. Promises by dangoor on Sunday October 04, 2015 @09:02PM (#10329477)
Sure, the `then`s could be pure functions but the whole point of my blog post is that I'd like to be able to test code that calls `fetch`. That would be possible if the actual side effecting operation is deferred to later, and not just the result.