ruby-concurrency / concurrent-ruby

Modern concurrency tools including agents, futures, promises, thread pools, supervisors, and more. Inspired by Erlang, Clojure, Scala, Go, Java, JavaScript, and classic concurrency patterns.
https://ruby-concurrency.github.io/concurrent-ruby/
Other
5.71k stars 420 forks source link

Promise? Future? Which is for what cases? #894

Closed naddika closed 2 years ago

naddika commented 4 years ago

In general promises and features are closely related, if not synonims. And in the documentation it says so too.

Therefore, it's confusing which one should be used in what circumstances. And how are they related in the gem? Is one of a more low level or outdated than the other? Do they basically both do the same thing?

Also, existense of these make it even more confusing:

* Concurrent::Promises.future
* Concurrent::Promises::Future
* Concurrent::Future
* [...possibly something similar...]
kvokka commented 4 years ago

Will try to answer you about it Concurrent::Promises::Future is an actual class which carry the implementation of future Concurrent::Promises.future is a helper class method, which give u a simple way to create a future Concurrent::Future is a deprecated module

chrisseaton commented 2 years ago

The idea was if you come to the gem looking for a future, you can have a future, and if you come to the gem looking for a promise, you can have a promise.