language.types · type ·

buffer of T

Contiguous typed storage for data processing, including explicit compute input and output.

computecontainers-and-handlescpugameplaygputypeyeho

A focused reference with a complete example. Numeric widths and experimental types still depend on the selected backend.

buffer of T

Status: documented

CPU · [cpu]

Apply damage to a small batch of health values on the explicit CPU route. Each invocation owns one element.

cpu · compute · gameplay · type checked

[cpu]
compute ApplyDamage(buffer of int health, int damage)
{
    int index = compute.index
    if index >= health.count { return }
    health[index] = health[index] - damage
}

buffer of int health
health.Add(100)
health.Add(80)
health.Add(60)
computeTask job = dispatch ApplyDamage(health, 10)
wait job
if job.failed { Console.Error(job.error.message) Process.Exit(1) }
for index from 0 < health.count { Console.Log(Text.From(health[index])) }
project.mech
manifestVersion = "2"
package = "api.example.language__buffers"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"
Expected output
90
70
50

GPU · [gpu]

Double a batch of reward values on native Metal. The [gpu] tag requires an accelerator backend; CPU oracle cannot silently satisfy it.

gpu · compute · gameplay · type checked

[gpu]
compute DoubleRewards(buffer of int rewards, int multiplier)
{
    int index = compute.index
    if index >= rewards.count { return }
    rewards[index] = rewards[index] * multiplier
}

buffer of int rewards
rewards.Add(100)
rewards.Add(80)
rewards.Add(60)
computeTask job = dispatch DoubleRewards(rewards, 2)
wait job
if job.failed { Console.Error(job.error.message) Process.Exit(1) }
for index from 0 < rewards.count { Console.Log(Text.From(rewards[index])) }
project.mech
manifestVersion = "2"
package = "api.example.language__buffers"
version = "0.1.0"
languageEdition = "yeho-core-2026.1"

[app]
kind = "headless"
Expected output
200
160
120
Notes and source

demonhunterlabs/app/lib/yeho-language-reference.ts