Altough I did find it helpful.
I think ppl that don't like the FP flow might find the thenables more complicated. For me it's the other way around.
notes: The technique of returning a function from a function is called higher order function, which allows you to do a partial-application of a function, something very common on FP languages/frameworks/libraries. The extent of this (when used up until the last parameter) is called currying.
While using this way also works, we should not un-necessarily return a function from another function as the inner function will remain in the memory occupying space even after the outer function has finished executing.
You can check out this article to better understand how memory leak can happen when using closures. In filter, map or reduce we provide a callback function as an argument. We don't return a function from a function there.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
meh
Altough I did find it helpful.
I think ppl that don't like the FP flow might find the thenables more complicated. For me it's the other way around.
notes: The technique of returning a function from a function is called higher order function, which allows you to do a partial-application of a function, something very common on FP languages/frameworks/libraries. The extent of this (when used up until the last parameter) is called currying.
While using this way also works, we should not un-necessarily return a function from another function as the inner function will remain in the memory occupying space even after the outer function has finished executing.
could you provide some feedback on this that demonstrates this is a memory leak?
What happens when we pass a "callback" to an Array.prototype.filter|map|reduce ?
What happens when we use libraries like lodash|lodash FP|Rambda and most of the frameworks we use that jump into callbacks from callbacks?
how do they handle those memory leaks? or do they not?
You can check out this article to better understand how memory leak can happen when using closures. In filter, map or reduce we provide a callback function as an argument. We don't return a function from a function there.