渲染zh-Hant

sponte

Translation status: 繁體中文 reader-locale proof. Code fences render through the zh-Hant pipeline; prose is canonical Latin.

Marks a named declaration slot (parameter or genus field) as voluntary — the caller or provider may omit the value.

Aliases: optional, voluntary

Syntax: <type> <name> sponte [= default | vel default]

Category#

declaration

Examples#

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

Marks a named declaration slot (parameter or genus field) as voluntary — the caller or provider may omit the value.

# =============================================================================
# sponte — Marks a named declaration slot (parameter or genus field) as voluntary — the caller or provider may omit the value.
# =============================================================================
#
# What this teaches:
#   • Voluntary parameter syntax — using `sponte` to mark function parameters or genus fields as optional
#   • Default values — combining `sponte` with `vel` to provide fallbacks when the value is omitted
#
# Common mistakes:
#   • confusing sponte (optional parameter with a default) with ∪ nihil (nullable type) — sponte marks omission, ∪ nihil marks absence
#
# See also: vel, nihil, ∪, functio, genus
# =============================================================================



# sponte — optional parameter / field marker
#
# GRAMMAR:
#   optionalMarker :← 'sponte'
#
# EXPECTED OUTPUT:
#   No incipit — declaration or test-runner surface only.
#
# BACKEND:
#   declaration-only optional slots (whitelist: sponte/sponte.fab). Cross-ref: optionalis/optionalis.fab.
#

fn greet(string nomen, string titulus optional)  string {
    return nomen
}

fn paginate(int pagina optional coalesce 1)  string {
    return "page"
}

class User {
    string name
    string email optional
}