渲染zh-Hans

iacit

Translation status: 简体中文 reader-locale proof. Code fences render through the zh-Hans pipeline; prose is canonical Latin.

Marks a function as able to throw along a recoverable channel.

Syntax: functio <name>(...) iacit → <type> [⇥ <error-type>]

Category#

function

Examples#

radix/corpus/meta/iacit.fab (canonical · modifier)#

Marks a function as able to throw along a recoverable channel.

# =============================================================================
# iacit — Marks a function as able to throw along a recoverable channel.
# =============================================================================
#
# What this teaches:
#   • the `iacit` modifier on function declarations — marks a function as throwable
#   • the `⇥` error type annotation for specifying the error type contract
#
# Common mistakes:
#   • Forgetting to declare the ⇥ error type — iacit requires an explicit ⇥ error type in the function signature.
#
# See also: iace, cape, ⇥, errata, immutata
# =============================================================================

# meta/iacit — throwable function modifier
#
# GRAMMAR:
#   funcModifier :← 'iacit'
#
# EXPECTED OUTPUT:
#   iacit surface declared
#
# BACKEND:
#   Prefer explicit ⇥ error types for callable contracts; see iace/functio-fallibilis.fab.

interface Canens {
    fn canta(string vox) throws  void
}

main {
    print "iacit modifier declared"
}

Expected output:

iacit modifier declared