रेंडरिंगhi

मरोजाओ

Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.

Raises a fatal error or panic.

Syntax: मरोजाओ <expression>

Category#

errors

Examples#

radix/corpus/mori/mori-si-guard.fab (canonical · keyword)#

Conditional fatal abort with यदि guard.

# =============================================================================
# मरोजाओ — Conditional fatal abort with यदि guard.
# =============================================================================
#
# What this teaches:
#   • fatal abort with `मरोजाओ` — unconditional and conditional (`यदि` guard) forms
#   • invariant enforcement — using `मरोजाओ` with guards to validate function preconditions
#   • the `यदि` guard is parser sugar for `यदि cond { मरोजाओ "msg" }`
#
# Common mistakes:
#   • Using मरोजाओ for recoverable errors — use इधरफेंको with a यदि guard and ⇥ for recoverable failure paths instead.
#
# See also: इधरफेंको, अतः, यदि
# =============================================================================

# मरोजाओ with optional यदि guard
#
# मरोजाओ <nuntius> [यदि <condicio>]
#
# GRAMMAR:
#   abortStmt :← 'मरोजाओ' expr ['यदि' expr]
#
# The optional `यदि` guard is parser sugar:
#   मरोजाओ "msg" यदि cond  →  यदि cond { मरोजाओ "msg" }
#
# Without the guard, मरोजाओ is unconditional (unchanged).
#
# EXPECTED OUTPUT:
#   "within range"
#   "positive"
#   "not empty"

fn clamp(int x, int min, int max) → int {
    # Guard: abort if min > max — invariant violation
    panic "range inverted" if min ≻ max

    # Guard: abort if value out of range
    panic "value out of range" if x ≺ min or x ≻ max

    return x
}

fn accessus(list<int> res, int index) → int {
    # Unconditional मरोजाओ — unchanged form
    if index ≺ 0 or index ≥ res.length() {
        panic "index out of bounds"
    }
    return res[index]
}

main {
    # Happy path — guards not triggered
    const int n ← clamp(5, 0, 10)
    print "within range"

    # Happy path — empty list guard not triggered
    const list<int> xs ← [1, 2, 3]
    const int y ← accessus(xs, 1)
    print "positive"

    const list<int> ys ← [42]
    const int z ← accessus(ys, 0)
    print "not empty"
}

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

Raises a fatal error or panic.

# =============================================================================
# मरोजाओ — Raises a fatal error or panic.
# =============================================================================
#
# What this teaches:
#   • fatal unrecoverable abort with `मरोजाओ` — halts execution with an error message
#   • invariant checking — using `मरोजाओ` for divisor and bounds checks
#
# Common mistakes:
#   • Using मरोजाओ for recoverable errors — use इधरफेंको with ⇥ for recoverable failure paths instead.
#
# See also: इधरफेंको, अतः
# =============================================================================

# मरोजाओ — fatal unrecoverable abort
#
# मरोजाओ <nuntius>
#
# GRAMMAR:
#   abortStmt :← 'मरोजाओ' expr
#
# EXPECTED OUTPUT:
#   Happy-path division and सूची access; मरोजाओ paths are commented out.

fn divide(int a, int b) → float {
    # Use मरोजाओ for invariant violations
    if b ≡ 0 {
        panic "divisio per nihilum"
    }
    return (a ↦ float) / (b ↦ float)
}

fn accipe(list<int> numeri, int index) → int {
    # Bounds check with मरोजाओ
    if index ≺ 0 or index ≥ numeri.length() {
        panic "index extra fines"
    }
    return numeri[index]
}

main {
    # Happy path — मरोजाओ branches not taken
    const float value ← divide(10, 2)
    # 5.0
    print "valor: §"(value)

    # This would call मरोजाओ:
    # स्थिर _ malum ← divide(10, 0)

    # Lista accessus
    const list<int> nums ← [1, 2, 3]
    const int lectum ← accipe(nums, 1)
    # 2
    print "valor: §"(lectum)
}