← Back to AILP Home

?! Emphatic Fallback

The source form is:

result_expr ?! fallback_expr

v0.33.3 ratified ?! as Result-only fallback unwrap with emphatic spelling. It does not call failsafe in source-level code.

Input Output
Result(_, V, false) ?! F V
Result(_, _, true) ?! F F
Optional/pointer/non-Result ?! F compile-time error

Example

func:maybe = int32(bool:ok) {
    if (ok) {
        pass 42i32;
    };
    fail 7i32;
};

func:main = int32() {
    int32:x = maybe(false) ?! 77i32;
    exit x;       // 77
};

Difference from ?

Runtime value flow currently matches ? fallback; the distinction is intentional spelling and Result-only emphasis.

int32:a = maybe(false) ?  77i32;
int32:b = maybe(false) ?! 77i32;

Both produce 77. ?! rejects Optional/pointer receiver shapes instead of acting like null coalescing.

Failsafe note

Older docs described ?! as a failsafe-dispatch operator. That is not the v0.33.x source contract.

The K semantics still has an older internal prefix form used by proof and runtime modeling, but source code should use the infix form shown here. kFailsafeEmphaticUnwrapErrCode = 47 is forward-reserved for a later failsafe cycle and is not wired by v0.33.6.