Kết xuấtvi

con_trỏ

Translation status: Tiếng Việt reader-locale proof. Term names and code fences follow the vi pack; supporting prose may still be English.

Compatibility annotation for stream/generator posture.

Syntax: @ con_trỏ

Category#

async

Examples#

radix/corpus/cursor/cursor.fab (canonical · keyword)#

Compatibility annotation for stream/generator posture.

# =============================================================================
# con_trỏ — Compatibility annotation for stream/generator posture.
# =============================================================================
#
# What this teaches:
#   • Preferred stream posture — write `sinh` for a synchronous stream or
#     `async_sinh` for an asynchronous stream.
#   • Compatibility annotation — `@ con_trỏ` remains accepted and preserved as
#     the legacy spelling for stream/generator posture.
#
# Common mistakes:
#   • Using `nhường` outside a stream body — `nhường` is valid only inside `sinh`
#     or `async_sinh` bodies, including compatible `@ con_trỏ` declarations.
#
# See also: sinh, async_sinh, nhường
# =============================================================================

# con_trỏ — compatibility stream annotation
#
# GRAMMAR:
#   annotation :← '@' 'con_trỏ'
#   callablePosture :← 'sinh' | 'async_sinh'
#
# EXPECTED OUTPUT:
#   Scalar stdout smoke (see body).
#
# BACKEND:
#   Cross-ref: tương_lai/futura.fab, lặp/cursor-iteratio.fab; Go whitelist: con_trỏ/cursor.fab.
#

@ con_trỏ { }
fn stream() → int {
    yield 1
    yield 2
}

main {
    print stream()
}

Expected output:

[1, 2]