การเรนเดอร์th-TH

nexum

Translation status: ภาษาไทย reader-locale proof. Code fences render through the th-TH pipeline; prose is canonical Latin.

Marks a class member as bound to the current instance.

Syntax: nexum <type> <name> [= <expression>]

Category#

type

Examples#

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

Marks a class member as bound to the current instance.

# =============================================================================
# nexum — Marks a class member as bound to the current instance.
# =============================================================================
#
# What this teaches:
#   • the `nexum` keyword — declares a compile-time constant bound to a genus (same value for every instance)
#   • accessing `nexum` fields via `ego` (implicit instance reference)
#   • instance overrides — bound fields can be overridden per-instance in constructor literals
#
# Common mistakes:
#   • Confusing nexum (compile-time constant bound to a genus) with cat (concatenation) or scriptum (string interpolation).
#
# See also: genus, ego
# =============================================================================

# nexum — bound genus field (compile-time constant)
#
# nexum <typus> <nomen> = <expressio>
#
# GRAMMAR:
#   boundField :← 'nexum' type ident '=' expr
#
# EXPECTED OUTPUT:
#   nexum.expected — bound field value 7 via accipe().

class Computator {
    # bound field — same value for every instance
    nexum int valor = 0

    fn accipe()  int {
        return self.valor
    }
}

main {
    # instance overrides bound default
    const _ c  Computator { valor = 7 }
    print c.accipe()
}

Expected output:

7