Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.md syntax fix for coming-from-other-languages.md #1584

Merged
merged 1 commit into from Feb 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/docs/coming-from-other-languages.md
Expand Up @@ -31,7 +31,7 @@ In addition promises are always unwrapped. A promise implicitly has `Task.Unwrap

See [this question on StackOverflow](http://stackoverflow.com/questions/26136389/how-can-i-realize-pattern-promise-deffered) for more differences.

##Scala
## Scala

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).

Expand All @@ -43,23 +43,23 @@ In addition promises are always unwrapped. That is, promises perform recursive a

See [this question on StackOverflow](http://stackoverflow.com/questions/22724883/js-deferred-promise-future-compared-to-functional-languages-like-scala) for more differences.

##Python
## Python

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.

A promise is _not_ similar to a Python `concurrent.Future` which does not chain actions.

Asyncio coroutines are similar to bluebird coroutines in what they let you do, however bluebird coroutines also enable functional-style chaining.

##C++
## C++

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).

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.

Boost futures expose a `.then` method similar to promises and allow this functionality.

##Haskell
## Haskell

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:

Expand All @@ -71,16 +71,16 @@ That is, you can return either a promise _or a plain value_ from a `then` withou

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.

##Java
## Java

A promise is similar to a guava `Future` with `chain` being similar to `then`.

If your'e familiar with Java 8 lambdas, you can think of a promise as a `Future` you can `map` to another future.

##Android Java
## Android Java

Several popular Android libraries use promises - for example the Parse Java API returns `Task`s which are similar to JavaScript promises.

##Objective-C
## Objective-C

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.