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

implet

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

Declares that a type implements one or more implendum contracts.

Aliases: implements

Syntax: genus <name> implet <interface-list> <block>

Category#

type

Examples#

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

Declares that a type implements one or more implendum contracts.

# =============================================================================
# implet — Declares that a type implements one or more implendum contracts
# =============================================================================
#
# What this teaches:
#   • Declares that a type implements one or more implendum contracts.
#   • Related keywords: genus, implendum
#
# Common mistakes:
#   • Declaring `genus implet Implendum` without implementing all required methods — every method signature in the implendum must have a body in the genus.
#
# See also: genus, implendum
# =============================================================================

# implet — genus implements a implendum (interface contract)
#
# genus Nomen implet Implendum { … }
#
# GRAMMAR:
#   genusDecl :← 'genus' ident 'implet' ident '{' methodDecl* '}'
#
# EXPECTED OUTPUT:
#   implet.expected — Aurelia from implendum plenum().

interface Nominatum {
    fn plenum()  string
}

class Civis implements Nominatum {
    string nomen

    fn plenum()  string {
        # satisfies implendum requirement
        return "§"(self.nomen)
    }
}

main {
    const _ civis  Civis { nomen = "Aurelia" }
    print civis.plenum()
}

Expected output:

Aurelia