Class StrictAbsent

java.lang.Object
org.ek9lang.compiler.phase7.support.StrictAbsent

public final class StrictAbsent extends Object
THE compile-time half of strict-absent mode (Steve, decision 5, 2026-10-07: "a residual absence PANICS, always").

Every compiled absence TEST - the IS_NULL at the head of ? (and so of guards, ?: and the comparison coalescing operators) and of ?? - answers a null quietly today: ? says false, ?? takes its right-hand side. In a well-typed program that null is unreachable (the front end proves every read is preceded by a write), so meeting one means the proof has a hole. When the COMPILING JVM has -Dek9.absent.strict=true (AbsentValue.STRICT_PROPERTY - the property is read the way IRAnalysis reads ek9.arcBalance.strict), the null branch of each such test begins with a Panic (PanicThrowInstrs) whose message is AbsentValue.message(String, String). Off (the default) this emits nothing, so the IR - and every @IR/@BYTECODE golden - is unchanged.

🔑 :=?'s own IS_NULL is NOT a strict site, deliberately: on the never-written slot of x as T? the null IS the case :=? exists for (it writes), and the front end credits it as the write (controls g25/a10 in docs/language-design/absence-evidence/controls). Callers say which kind of test they are building; nothing else may decide it.

The runtime half - the null tolerances in ek9-lang - reads the same property on the JVM that RUNS the program (see AbsentValue). Back ends: the Panic is ordinary IR, so the LLVM back end gets it with no work.

  • Method Details

    • isEnabled

      public static boolean isEnabled()
      Is strict-absent mode on for this compilation?
    • message

      public static String message(StrictAbsent.Observer observer)
      THE strict-absent Panic message for a compiled absence test.
    • emitIfEnabled

      public static void emitIfEnabled(IRGenerationContext stackContext, List<IRInstr> instructions, StrictAbsent.Observer observer, DebugInfo debugInfo)
      In strict-absent mode, append the Panic to instructions - the start of the branch a compiled absence test takes on a null. Otherwise append nothing.
      Parameters:
      stackContext - for temp names and the current scope
      instructions - the null branch being built
      observer - what observed the null, and where
      debugInfo - the debug information carried by the emitted instructions