You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docs/coming-from-other-languages.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ In addition promises are always unwrapped. A promise implicitly has `Task.Unwrap
31
31
32
32
See [this question on StackOverflow](http://stackoverflow.com/questions/26136389/how-can-i-realize-pattern-promise-deffered) for more differences.
33
33
34
-
##Scala
34
+
##Scala
35
35
36
36
A bluebird promise is similar to a Scala `Future`. A scala `Promise` is similar to how the promise constructor can be used (previously, to a bluebird Deferred).
37
37
@@ -43,23 +43,23 @@ In addition promises are always unwrapped. That is, promises perform recursive a
43
43
44
44
See [this question on StackOverflow](http://stackoverflow.com/questions/22724883/js-deferred-promise-future-compared-to-functional-languages-like-scala) for more differences.
45
45
46
-
##Python
46
+
##Python
47
47
48
48
A promise is similar to a Twisted Deferred object. In fact the first JavaScript implementations of promises were based on it. However, the APIs have diverged since. The mental model is still very similar.
49
49
50
50
A promise is _not_ similar to a Python `concurrent.Future` which does not chain actions.
51
51
52
52
Asyncio coroutines are similar to bluebird coroutines in what they let you do, however bluebird coroutines also enable functional-style chaining.
53
53
54
-
##C++
54
+
##C++
55
55
56
56
A bluebird promise is similar to a `std::future` and the promise constructor is similar to an `std::promise` although it should rarely be used in practice (see the promisification section).
57
57
58
58
However, a bluebird promise is more powerful than the current implementation of `std::future` since while chaining has been discussed it is not yet implemented. Promises can be chained together.
59
59
60
60
Boost futures expose a `.then` method similar to promises and allow this functionality.
61
61
62
-
##Haskell
62
+
##Haskell
63
63
64
64
A promise is a monadic construct with `.then` filling the role of `>>=` (bind). The major difference is that `.then` performs recursive assimilation which acts like a `flatMap` or a map. The type signature of `then` is quote complicated. If we omit the error argument and not throw - it's similar to:
65
65
@@ -71,16 +71,16 @@ That is, you can return either a promise _or a plain value_ from a `then` withou
71
71
72
72
Promises perform a role similar to `IO` in that they allow for easy chaining of asynchronous non-blocking operations.`Promise.coroutine` can be seen as similar to `do` notation although in practice it's not an accurate comparison.
73
73
74
-
##Java
74
+
##Java
75
75
76
76
A promise is similar to a guava `Future` with `chain` being similar to `then`.
77
77
78
78
If your'e familiar with Java8 lambdas, you can think of a promise as a `Future` you can `map` to another future.
79
79
80
-
##Android Java
80
+
##Android Java
81
81
82
82
Several popular Android libraries use promises - for example the ParseJavaAPI returns `Task`s which are similar to JavaScript promises.
83
83
84
-
##Objective-C
84
+
##Objective-C
85
85
86
86
If you're familiar with PromiseKit, it is based on a same specification bluebird is based on so the API should feel familiar right away.
0 commit comments