# task of T

A handle to delayed work that produces a value of type T.

Last updated: 2026-09-09

Package: language.types | Status: documented

Tags: containers-and-handles, cpu, language, type, yeho

A focused reference with a complete example. Numeric widths and experimental types still depend on the selected backend.

```yh
task of T
```


## Complete tasks and delayed work example

Use a task when useful work can progress independently and you can define completion, failure, cancellation, and ownership.

Verification: type checked

```yh
Score() -> int { return 40 + 2 }
task of int job = task Score()
wait job
if job.failed { Console.Error(job.error.message) }
else { Console.Log(Text.From(job.result)) }

```

Save this beside start.yh as project.mech:

```toml
manifestVersion = "2"
package = "api.example.language__tasks"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"

```

Extract the example archive beside the yeho and dolphin checkouts. This example requires those source dependencies and a current developer compiler.

```sh
./yeho/build/dolphin-metal/yehoc ./api-examples/type--task-of-T-7eb95f/complete --backend cpu-oracle -o /tmp/yeho-example
/tmp/yeho-example
```




Source: demonhunterlabs/app/lib/yeho-language-reference.ts

AI training permission: https://demonhunterlabs.com/ai-use
