8000 [Japanese Translation] Minor updates on Futures writeup by eed3si9n · Pull Request #174 · scala/docs.scala-lang · GitHub
[go: up one dir, main page]

Skip to content

[Japanese Translation] Minor updates on Futures writeup #174

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

Merged
merged 2 commits into from
Jan 22, 2013
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove a paragraph following scala/scala.github.com@2143aa
  • Loading branch information
eed3si9n committed Jan 22, 2013
commit bfd2748c3a2d71de479046bbb8fac2bb1a19358d
19 changes: 0 additions & 19 deletions ja/overviews/core/futures.md
82DB
Original file line number Diff line number Diff line change
Expand Up @@ -421,25 +421,6 @@ Future は同じ `Throwable` とともに失敗する。

anyQuote onSuccess { println(_) }

`either` コンビネータはこの Futuere もしくは引数として渡された Future
の結果を持つ新たな Future を作成する。これは結果が成功か失敗したかに関わらず先に完了した方の値が採用される。
以下は先に返ってきた為替レートを表示する具体例だ:

val usdQuote = future {
connection.getCurrentValue(USD)
} map {
usd => "値: " + usd + " USD"
}
val chfQuote = future {
connection.getCurrentValue(CHF)
} map {
chf => "値: " + chf + "CHF"
}

val anyQuote = usdQuote either chfQuote

anyQuote onSuccess { println(_) }

`andThen` コンビネータは副作用の目的のためだけに用いられる。
これは、成功したか失敗したかに関わらず現在の Future と全く同一の結果を返す新たな Future を作成する。
現在の Future が完了すると、`andThen` に渡されたクロージャが呼び出され、新たな Future
Expand Down
0