cursor
Translation status: 简体中文 reader-locale proof. Code fences render through the zh-Hans pipeline; prose is canonical Latin.
Compatibility annotation for stream/generator posture.
Syntax: @ cursor
Category#
async
Related#
Examples#
radix/corpus/cursor/cursor.fab (canonical · keyword)#
Compatibility annotation for stream/generator posture.
# =============================================================================
# cursor — Compatibility annotation for stream/generator posture.
# =============================================================================
#
# What this teaches:
# • Preferred stream posture — write `fiunt` for a synchronous stream or
# `fient` for an asynchronous stream.
# • Compatibility annotation — `@ cursor` remains accepted and preserved as
# the legacy spelling for stream/generator posture.
#
# Common mistakes:
# • Using `cede` outside a stream body — `cede` is valid only inside `fiunt`
# or `fient` bodies, including compatible `@ cursor` declarations.
#
# See also: fiunt, fient, cede
# =============================================================================
# cursor — compatibility stream annotation
#
# GRAMMAR:
# annotation :← '@' 'cursor'
# callablePosture :← 'fiunt' | 'fient'
#
# EXPECTED OUTPUT:
# Scalar stdout smoke (see body).
#
# BACKEND:
# Cross-ref: futura/futura.fab, itera/cursor-iteratio.fab; Go whitelist: cursor/cursor.fab.
#
@ cursor
fn stream() → int {
yield 1
yield 2
}
main {
print stream()
}Expected output:
[1, 2]