8000 further tweak Future doc · ee08b397/scala.github.com@4085611 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4085611

Browse files
committed
further tweak Future doc
followup to 5bbe5bb
1 parent e3e94df commit 4085611

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

overviews/core/_posts/2012-09-20-futures.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@ once.
200200
Once a `Future` object is given a value or an exception, it becomes
201201
in effect immutable-- it can never be overwritten.
202202

203-
The simplest way to create a future object is to invoke the `Future`
203+
The simplest way to create a future object is to invoke the `Future.apply`
204204
method which starts an asynchronous computation and returns a
205205
future holding the result of that computation.
206206
The result becomes available once the future completes.
207207

208208
Note that `Future[T]` is a type which denotes future objects, whereas
209-
`Future` is a method which creates and schedules an asynchronous
209+
`Future.apply` is a method which creates and schedules an asynchronous
210210
computation, and then returns a future object which will be completed
211211
with the result of that computation.
212212

@@ -226,7 +226,7 @@ a request to obtain a list of friends of a particular user:
226226
}
227227

228228
Above, we first import the contents of the `scala.concurrent` package
229-
to make the type `Future` and the construct `Future` visible.
229+
to make the type `Future` visible.
230230
We will explain the second import shortly.
231231

232232
We then initialize a session variable which we will use to send
@@ -237,7 +237,7 @@ has to be sent over a network, which can take a long time.
237237
This is illustrated with the call to the method `getFriends` that returns `List[Friend]`.
238238
To better utilize the CPU until the response arrives, we should not
239239
block the rest of the program-- this computation should be scheduled
240-
asynchronously. The `Future` method does exactly that-- it performs
240+
asynchronously. The `Future.apply` method does exactly that-- it performs
241241
the specified computation block concurrently, in this case sending
242242
a request to the server and waiting for a response.
243243

@@ -258,7 +258,7 @@ The line `import ExecutionContext.Implicits.global` above imports
258258
the default global execution context.
259259
Execution contexts execute tasks submitted to them, and
260260
you can think of execution contexts as thread pools.
261-
They are essential for the `Future` method because
261+
They are essential for the `Future.apply` method because
262262
they handle how and when the asynchronous computation is executed.
263263
You can define your own execution contexts and use them with `Future`,
264264
but for now it is sufficient to know that
@@ -749,7 +749,7 @@ the throwable types it matches.
749749
-->
750750

751751
<!--
752-
Invoking the `Future` construct uses a global execution context to start an asynchronous computation. In the case the client desires to use a custom execution context to start an asynchronous computation:
752+
Invoking the `Future.apply` construct uses a global execution context to start an asynchronous computation. In the case the client desires to use a custom execution context to start an asynchronous computation:
753753
754754
val f = customExecutionContext Future {
755755
4 / 2

0 commit comments

Comments
 (0)
0