Record write-once builds against repeated reads and report the cache state.

Once Value Coordination Report

once_value_coordination_report.swift
let reads = 
var cached: Int? = nil
var builds = 0
var served = 0

func build() -> Int {
    builds += 1
    return 7
}

for _ in 0..<reads {
    if cached == nil {
        cached = build()
    }
    if let value = cached, value > 0 {
        served += 1
    }
}

var status = "set"
if builds == 0 {
    status = "unset"
}
if served > 1 {
    status = "locked"
}

let line = "reads=\(reads) served=\(served) builds=\(builds) \(status)"

print(line)
let reads = 
var cached: Int? = nil
var builds = 0
var served = 0

func build() -> Int {
    builds += 1
    return 7
}

for _ in 0..<reads {
    if cached == nil {
        cached = build()
    }
    if let value = cached, value > 0 {
        served += 1
    }
}

var status = "set"
if builds == 0 {
    status = "unset"
}
if served > 1 {
    status = "locked"
}

let line = "reads=\(reads) served=\(served) builds=\(builds) \(status)"

print(line)
let reads = 
var cached: Int? = nil
var builds = 0
var served = 0

func build() -> Int {
    builds += 1
    return 7
}

for _ in 0..<reads {
    if cached == nil {
        cached = build()
    }
    if let value = cached, value > 0 {
        served += 1
    }
}

var status = "set"
if builds == 0 {
    status = "unset"
}
if served > 1 {
    status = "locked"
}

let line = "reads=\(reads) served=\(served) builds=\(builds) \(status)"

print(line)
write-once value A coordination report can record how a write-once value is shared. A nil cache slot is filled on the first read by a `build` step that bumps a build counter, and every later read finds the slot already set and reuses the one cached value, so the initializer runs at most once. This scalar cache models the write-once guarantee deterministically, since Swift has no top-level lazy primitive that the trace bridge can record cleanly. With no reads the slot stays unset, with one read it is set, and with repeated reads it is locked to the single build. The status line summarizes the state while the build counter confirms one build.