generis
Translation status: हिन्दी reader-locale proof. Code fences render through the hi pipeline; prose is canonical Latin.
Marks a class member as belonging to the type itself.
Syntax: generis <type> <name> [= <expression>]
Category#
type
Related#
Examples#
radix/corpus/generis/generis.fab (canonical · keyword)#
Marks a class member as belonging to the type itself.
# =============================================================================
# generis — Marks a class member as belonging to the type itself
# =============================================================================
#
# What this teaches:
# • Marks a class member as belonging to the type itself.
# • Related keywords: genus, nexum
#
# Common mistakes:
# • Accessing a `generis` field on an instance instead of the type — `generis` fields are static members accessed via the genus name, not via `ego`.
#
# See also: genus, nexum
# =============================================================================
# generis marks a static genus field (shared across instances)
#
# generis <type> <field> = <initium> -- class-level binding, not per-instance
#
# GRAMMAR:
# fieldDecl inside genusDecl :← 'generis'? type ident ('=' expr)?
#
# EXPECTED OUTPUT:
# ruber
#
# Instance field `nomen` is per-object; `generis ruber` would be accessed on the
# genus type in full programs (here only instance fields are read).
class Color {
static string ruber = "#ff0000"
string nomen = "ruber"
}
main {
const _ color ← Color {}
print color.nomen
}Expected output:
ruber