cura
Translation status: 简体中文 reader-locale proof. Code fences render through the zh-Hans pipeline; prose is canonical Latin.
Starts an allocator scope.
Syntax: cura \"<allocator-kind>\" fixum _ <alloc> <block>
Category#
resource
Related#
- arena
Examples#
radix/corpus/cura/cura.fab (canonical · keyword)#
Starts an allocator scope.
# =============================================================================
# cura — Starts an allocator scope.
# =============================================================================
#
# What this teaches:
# • Allocator scoping — `cura "arena"` introduces an arena allocator scope for a binding, with a block body that runs within the scope.
# • Future-aware syntax — Rust lowers to a no-op with a warning; Faber/TS preserve the syntax for future real allocators.
#
# Common mistakes:
# • Expecting real arena allocation behavior — currently a no-op in the Rust backend.
#
# See also: arena
# =============================================================================
# cura "arena" — allocator-scoped binding
#
# cura "arena" introduces an arena allocator scope for a binding.
#
# GRAMMAR:
# cura "arena" fixum _ <name> { <body> }
#
# Rust lowers to a no-op with a warning; Faber/TS preserve arena syntax for future
# real allocators. Body runs normally.
#
# EXPECTED OUTPUT:
# "in arena".
main {
with "arena" const _ alloc {
print "in arena"
}
}Expected output:
in arena