Functional programming is often explained to agree with lazy evaluation.
As far as I know lazy evaluation means that a method gets called if the evaluator/browser/etc. thinks that is the next best thing to do.
I've read about lazy evaluation here.
That makes me think; promises
are designed to run, and after they are done you do the next best thing. You controll the flow.
I've read that promises
are functional here.
In my tiny brain, those statements are the complete opposites.
The one is telling me to evaluate a statement whenever there is time; functional programming has no side-effects so it should not matter.
The other is telling me that you should run something when there is time, but you use Async behaviour after that. In other words, you make sure one function is done, then execute the next function.
Am I correct stating that pure functional programming should not contain promises? And that functions containing promises are by definition not pure?
I know promises and callbacks can be useful, just trying to give myself a clear view of the definition of functional programming.