double_buffer
Builtin index · Collections & strings
result = double_buffer(initial)
Input: initial · Output: result
What it is
initial is any value.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = double_buffer(initial) | initial —not documented yet | result — | Returns a double_buffer handle; front AND back both start equal to initial. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
b = double_buffer(1)
b.write(2)
print(b.read()) # 1 -- the write above is not visible yet
b.swap()
print(b.read()) # 2 -- now it is
output
1 2
from collections-strings
How it works
double_buffer(initial) (§ data structures pass, 2026-09-01, primitive. "write" on a Value::DoubleBuffer is a guarded arm further up this match (next to Value::File/ Value::Serial's own "write" arms); "double_buffer"/ "read"/"swap" have no competing meaning anywhere else.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.