Skip to content

Commit c26ebfe

Browse files
committed
Remove unnecessary use of "async let".
1 parent 1b1e137 commit c26ebfe

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

proposals/nnnn-actors.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -449,15 +449,16 @@ In the example above the `Person` can think of a good or bad idea, shares that o
449449
This is exemplified by the following piece of code, exercising the `decisionMaker` actor:
450450

451451
```swift
452-
async let shouldBeGood = person.thinkOfGoodIdea() // runs async
453-
async let shouldBeBad = person.thinkOfBadIdea() // runs async
452+
let goodThink = Task.runDetached { await person.thinkOfGoodIdea() } // runs async
453+
let badThink = Task.runDetached { await person.thinkOfBadIdea() } // runs async
454+
455+
let shouldBeGood = await goodThink.get()
456+
let shouldBeBad = await badThink.get()
454457

455458
await shouldBeGood // could be .goodIdea or .badIdea ☠️
456459
await shouldBeBad
457460
```
458461

459-
> This issue is illustrated by using async lets, however also simply manifest by more than one actor calling out to the same decision maker; one invoking `thinkOfGoodIdea` and the other one `thinkOfBadIdea`.
460-
461462
This snippet _may_ result (depending on timing of the resumptions) in the following execution:
462463

463464
```swift

0 commit comments

Comments
 (0)