DEV Community

Cover image for Colorless async/await in Firefly
Joakim Ahnfelt-Rønne
Joakim Ahnfelt-Rønne

Posted on

Colorless async/await in Firefly

In the last post, we sketched out the high level rules of the async/await inference. This post will show how it works under the hood for a concrete example that reads two files concurrently, and then concatenates the result:

readTwo(system: System, file1: String, file2: String): String {
    let pair = system.tasks.concurrently(
        {system.files.readText(file1)},
        {system.files.readText(file2)}
    )
    pair.first + pair.second
}
Enter fullscreen mode Exit fullscreen mode

Continue reading: https://www.ahnfelt.net/async-await-inference-in-firefly-part-2/

Top comments (0)