Lowent Manual←↑→

Appendix A — Words, core ops and builtin ops

The text is where words are explained. This appendix gathers only tables to skim when you get stuck reading code. The word list is the same as the specification’s Appendix A, and anything not in that list is not a word.

The forty-eight words#

KindWordsChapter
Declarationsmodule use type newtype struct enum trait contract actor statechapters 21 and 13
opsfn proc export unsafe extern satisfieschapter 5
Localslet var set keepchapter 6
Flowif else while for repeat range cycle next step guard match case return break continue trychapter 7
Expressions and valuesexpr lit true false nonechapter 8
Concurrencyspawn sendchapter 25
Ownershipdropchapter 19
Teststest expectchapter 31
Blocksdo endchapter 3

Table 50.1 — All the words

rem and note are markers opening comments, and clause heads such as input, output, effects and requires and core ops such as add and len are not words but cannot be used as names.

Removed words#

RemovedInstead
loopwhile true
givereturn
unitvoid
calcop · procopfn · proc
is · as (in declarations) · localNot written
to · in (field access)field a. b . · idx a. i. .
onproc inside an actor
failreturn error <variant>
; · ,.
makelit
indexidx
def struct·def enum·def type·def newtype (E-DEF-OLD)delete def — struct · enum · type · newtype

Table 50.2 — Removed words and what to use instead (E-VOCAB-REMOVED)

as and to remain only as position markers in use … as <alias> and case <low> to <high>.

Frequently used core ops#

KindOperations
Arithmetic (stopping)add sub mul div mod neg abs min max
Arithmetic (choosing the outcome)wrap_* sat_* chk_* div_nz nonzero_of
Changing widthwiden narrow narrow_wrap narrow_sat narrow_try cast bit_cast
Comparison and logiceq ne lt le gt ge and or not
Bitsbit_and bit_or bit_xor bit_not shl shr rotl rotr wrap_shl wrap_shr count_ones leading_zeros trailing_zeros byte_swap
Sequenceslen idx subslice view view_array same_slice copy
Groupingsfield method isa payload
Answer-carrying typessome ok error is_some is_none is_ok is_error some_value ok_value error_value value_or
Translation timesize_of comptime config
Allocationalloc_bytes
Atomicatomic_load atomic_store atomic_add atomic_sub atomic_swap atomic_cas atomic_fence
Devicesread_volatile write_volatile
Concurrencyawait drain channel chsend chrecv yield spawn send
Atomic (bits)atomic_and atomic_or atomic_xor
Pipe stages — chapter 24pipe map filter fold scan take skip zip enumerate collect count all any into
Lanes (SIMD) — chapter 27splat load store load_masked store_masked lane_select lane_any lane_all reduce_add reduce_mul reduce_min reduce_max lane_avg native_lanes lane_reverse lane_rotate shuffle prefetch
Small-number sets — chapter 13bitset_new bitset_count bitset_insert bitset_union bitset_intersect bitset_difference bitset_complement bitset_contains bitset_is_subset bitset_is_empty bitset_remove
Layouts and views — chapter 13encode try_view view_segments capacity
Borrows and regions — chapter 12 · chapter 18ref mut_ref deref borrow region stack_new stack_count push pop swap
Contracts and errors — chapter 14range ret expect panic elem_lt elem_le elem_gt elem_ge
Builtin ops (computation) — stand only after call_builtinclmul_lo clmul_hi mul_hi aes_round aes_round_last aes_ctr ghash chacha20 poly1305 aes_gcm chacha_poly sha256 sha384 sha512 crc32 hash_bytes rng_next
C strings and callbacks — chapter 29cstr_of str_from_cstr unsafe_fn
Builtin ops (files, network, processes) — only after call_builtinfile_open file_read file_write file_seek file_close file_type link_type dir_open dir_read dir_close dir_make path_remove path_rename net_listen net_accept net_connect net_resolve net_send net_recv net_close net_pair net_port proc_spawn proc_read proc_poll proc_wait proc_kill
Builtin ops (standard I/O · arguments · environment · clock · terminal · random · reactor) — stand only after call_builtinwrite_out read_in arg env_get time_now time_local time_sleep tty_raw tty_read tty_size random_bytes reactor_new r_read r_write
Builtin ops (floating-point functions) — stand only after call_builtin · chapter 4sqrt sin cos exp log pow floor ceil round fmod sum_neumaier sum_seq

Table 50.3 — Kinds of core ops and builtin ops

★ Builtin ops have a name space of their own. They stand only in that position — call_builtin sha256 msg. out. . — and you may use the same spelling for a name of yours. Calling one bare when no name of yours is spelt that way is E-BUILTIN-BARE; naming something else after call_builtin is E-BUILTIN-NAME. Builtin ops are the material the system library is built from; a program calls the module that wraps them (chapter 32).

This table sorts every core op and builtin op of the canon into a group. The chapter next to each group name explains that group with examples. The one-line meanings are authoritative in the repository’s docs/spec/BUILTIN-MEANINGS.tsv.

Effects and capabilities#

EffectPermitting capabilityChapter
iocap io · file_system · net · tty · clock · randomchapter 16
alloc · heapcap allocator · cap heapchapters 18 and 20
atomiccap atomicchapter 27
devicecap mmiochapter 30
unsafecap c · cap machine (depending on use)chapters 29 and 30
state · panic · wait · concurrentWritten without capabilitieschapters 15 and 26

Table 50.4 — Effect atoms and their paired capabilities