8000 Merge pull request #562 from li-zhirui/master · ee08b397/scala.github.com@e3e94df · GitHub
[go: up one dir, main page]

Skip to content

Commit e3e94df

Browse files
authored
Merge pull request scala#562 from li-zhirui/master
correct the method name for creating Future
2 parents 06ebe67 + 5bbe5bb commit e3e94df

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

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

Lines changed: 7 additions & 7 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`
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` 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

@@ -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` 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

@@ -246,7 +246,7 @@ responds.
246246

247247
An unsuccessful attempt may result in an exception. In
248248
the following example, the `session` value is incorrectly
249-
initialized, so the computation in the `future` block will throw a `NullPointerException`.
249+
initialized, so the computation in the `Future` block will throw a `NullPointerException`.
250250
This future `f` is then failed with this exception instead of being completed successfully:
251251

252252
val session = null
@@ -258,9 +258,9 @@ 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` method because
262262
they handle how and when the asynchronous computation is executed.
263-
You can define your own execution contexts and use them with `future`,
263+
You can define 7C5B your own execution contexts and use them with `Future`,
264264
but for now it is sufficient to know that
265265
you can import the default execution context as shown above.
266266

@@ -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` 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