Unreal Verse
Overview
Use Epic documentation as the source of truth for Verse syntax and behavior. Route each task to the right doc first, then implement with minimal, valid patterns.
Workflow
- Classify the task.
- Open the matching section in
references/verse-doc-index.md. - Draft the smallest valid Verse solution first.
- Verify effects (
<suspends>,<transacts>,<decides>), failure contexts, and container access. - Return code plus a short rationale tied to the referenced docs.
Minimal Common Patterns
Use these as copy-start snippets, then adapt names and imports to the target project.
Class With Mutable State
counter := class:
var total:int = 0
Add(value:int):void =
set total += value
Failable Lookup (Option/Failure Context)
if (first := numbers[0]):
Print("{first}")
Map Insert + Read
scores:[string]int = map{}
set scores["alice"] = 10
if (score := scores["alice"]):
Print("{score}")
Basic Loop
for (n := 0..2):
Print("{n}")
Suspending Function
DoLater()<suspends>:void =
Sleep(1.0)
Race Two Tasks
winner := race:
TaskA()
TaskB()
Execution Rules
- Prefer explicit parameter and return types.
- Keep functions small and compose behavior from small helpers.
- Treat indexing and map reads as failable operations.
- Use specifiers/attributes only when needed and verify exact syntax in docs.
- Use
race,sync, andbranchdeliberately; always reason about cancellation and lifetime. - Check language-version notes before using newer syntax in older projects.
Output Expectations
- Produce code that compiles conceptually against current Verse docs.
- Cite the specific Epic page used for non-trivial constructs.
- Keep examples minimal unless the user asks for full architecture.