// in using Task based on the fun-task library
Task.create((res, rej) => res(5)).run({
success: console.log,
failure: console.error
});
// 5
// using Future through Fluture
Future((reject, resolve) => res(5)).fork(
console.error,
console.log
);
// 5
As you can see in here, both accepts function computation, lazy and both are composable. So what are the main difference between these types.
Note: I am the author of Fluture.
FunTask was created as an alternative to Fluture that allowed for cancellation and exception catching.
Shortly after its release, I worked together with the author of FunTask, Roman Pominov, to add cancellation to Fluture as well.
Finally, since the release of version 9.0.0 about two years later, Fluture also has the capability to catch thrown exceptions. The reason it came so late is because on older versions of V8 this had a huge impact on performance. It has only recently been made fast to have
try
/catch
statements everywhere.These additions to the Fluture library mean that these days, apart from the minor differences in API, there are very few differences between Fluture and FunTask. Though Fluture has continued to evolve, and includes benefits like stack safety and better performance.
For reference, I've been keeping track of differences between different Future-like libraries in JavaScript in a wiki page on Fluture's GitHub: https://github.com/fluture-js/Fluture/wiki/Comparison-of-Future-Implementations