Renderingen-US

Experimental through version 1. Version 0 was alpha. This is the first language release: the interface is relatively stable, not frozen. Nothing is promised stable until version 2.

list<b8>

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

A byte buffer is a list<b8>; hex literals like |ref call be ef| write one.

Syntax: list<b8>

Category#

bits

Examples#

radix/corpus/reference/keyword/list-b8/octeti.fab (canonical · keyword)#

A byte buffer is a list<b8>; hex literals like |ref call be ef| write one.

# =============================================================================
# list<b8> — byte buffer.
# =============================================================================
#
# What this teaches:
#   • Buffer type — a byte buffer is `list<b8>`, a list of raw 8-bit values (analogous to `Vec<u8>` in Rust).
#   • Literal syntax — A `list<b8>` can be written with hex literals like `|ref call be ef|`.
#
# Common mistakes:
#   • Writing byte-buffer hex literals with an odd digit count — each byte requires two hex digits.
#
# See also: string, list, bits
# =============================================================================

# list<b8> — byte-buffer type alias
#
# type Fascis = list<b8>
#
# GRAMMAR:
#   typeAliasDecl :← 'type' ident '=' typeExpr
#
# EXPECTED OUTPUT:
#   octeti.expected — type-known line.

type Fascis = list<b8>

main {
    let list<b8> sig ← |ref call be ef|
    let list<b8> hello ← |48 65 6c 6c 6f|
    let list<b8> empty ← ||
    print "octeti typus notus"
}

Expected output:

octeti typus notus

radix/corpus/reference/reject/list-b8/conversio-octeti-to-octeti-decline.fab (supporting · reject)#

Decline: bounded list<b8, size N> cannot resize directly to bounded list<b8, size M>.

# =============================================================================
# bounded list<b8, size N> resize — unsupported conversion decline
# =============================================================================
#
# What this teaches:
#   • Bounded byte capacities are not interchangeable through an implicit
#     resize route.
#   • The unsupported route fails closed with `SEM016:unsupported_conversio`.
#
# Common mistakes:
#   • expecting a bounded byte conversion to truncate or pad silently.

fn resize(list<b8, size 8> raw) → list<b8, size 4> {
    return raw ↦ list<b8, size 4>
}

Expected: compilation rejects this example.

radix/corpus/reference/reject/list-b8/conversio-octeti-to-textus-decline.fab (supporting · reject)#

Decline: bounded list<b8, size N> cannot convert directly to unbounded string.

# =============================================================================
# bounded list<b8, size N> to string — unsupported conversion decline
# =============================================================================
#
# What this teaches:
#   • A bounded byte carrier does not silently become string through `↦`.
#   • The unsupported route fails closed with `SEM016:unsupported_conversio`.
#
# Common mistakes:
#   • assuming byte decoding is the same as a bounded-width copy — decoding
#     needs an explicit list<b8>/textus library route, not this conversion.

fn widen(list<b8, size 8> raw) → string {
    return raw ↦ string
}

Expected: compilation rejects this example.

radix/corpus/reference/reject/list-b8/literal-invalid-char-reject.fab (supporting · reject)#

Byte-list literals take hex digits only: |zz| rejects with SEM011:octeti_literal_invalid_character naming the offending character.

# =============================================================================
# list<b8> — Byte-list literals take hex digits only.
# =============================================================================
#
# What this teaches:
#   • Between the bars only hex digit pairs (and spaces) are legal
#   • `|zz|` rejects with SEM011:octeti_literal_invalid_character, naming the offending character
#
# Common mistakes:
#   • Writing a non-hex character inside `|…|` — digits 0-9 and a-f only
#
# See also: list<b8>, b8
# =============================================================================

# list<b8> reject case — expected compile failure
#
# This exemplum intentionally fails to compile.

main {
    let list<b8> a ← |zz|
    print a
}

Expected: compilation rejects this example.

radix/corpus/reference/reject/list-b8/literal-odd-reject.fab (supporting · reject)#

A byte-list literal needs two hex digits per byte: |686| has three digits and rejects with SEM011:octeti_literal_odd_digit_count.

# =============================================================================
# list<b8> odd digit count — A byte-list literal needs two hex digits per byte.
# =============================================================================
#
# What this teaches:
#   • Every byte in a byte-list hex literal is exactly two hex digits (|ref call be ef|)
#   • |686| has three digits, so no byte boundary exists — SEM011 rejects it by name
#
# Common mistakes:
#   • Writing |686| and expecting the lone digit to pad — each byte needs exactly two digits
#
# See also: list<b8>, b8
# =============================================================================

# list<b8> odd-digit reject case — expected compile failure
#
# This exemplum intentionally fails to compile.

main {
    let list<b8> a ← |686|
    print a
}

Expected: compilation rejects this example.

radix/corpus/reference/reject/list-b8/literal-template-reject.fab (supporting · reject)#

A byte-list literal is not a callable template: applying it as |00|(id) rejects with SEM011:octeti_literal_template_application.

# =============================================================================
# list<b8> — a byte-list literal is not a callable template
# =============================================================================
#
# What this teaches:
#   • Byte-buffer literals are data, not templates — no holes, no application
#   • `|00|(id)` parses as a call on the literal and rejects with
#     SEM011:octeti_literal_template_application
#
# Common mistakes:
#   • Writing `|…|(args)` for string-style templating — use string (format)
#     formatting instead of calling a byte-list literal
#
# See also: list<b8>, format
# =============================================================================

# list<b8> reject case — expected compile failure
#
# This exemplum intentionally fails to compile.

main {
    let _ id ← 1
    let _ bad ← |00|(id)
    print bad
}

Expected: compilation rejects this example.