null and nullable types (T?)#
Prefix LNUL. A first-class absent value, in place of "" as
missing: negated existence is
[LNUL.4.7] and the narrowing boundary is [LNUL.5.4]. Paired
with [LEXP] (operators / ??),
[LDET],
[LGRA] (T? surface), and [LSER] (the series
boundary, [LNUL.7]). The DSC null encoding is [LNUL.6.3].
The value [LNUL.2]#
[LNUL.2.1] One canonical value, spelled null — the same spelling as
Json null, which the language already represents. There is exactly one
null (no
NaN-style variants), so it hashes, encodes, orders, and compares identically
on every conforming engine.
checks: idris
Nullable types [LNUL.3]#
[LNUL.3.1] Nullability is opt-in, per declaration: T?. A slot
state: Float can never be null; state: Float? may be. The default is
non-null.
[LNUL.3.2] Flow-typed, not boxed. The runtime value is a plain null; the
compiler tracks T? and refuses to use a T? where a T is required until
it is narrowed ([LNUL.5]). There is no Maybe<T> tagged union and no
generics — nothing new to propagate through the Rete network. (This is the
Kotlin/Swift T? model, not Rust's Option<T>.)
see also: LNUL.5
[LNUL.3.3] null is assignable to any T?. The literal null alone has type
null, the bottom of every T?.
[LNUL.3.4] A Json document whose root is null is the canonical null,
not a document. There is exactly one null ([LNUL.2.1]), so a JSON null
read as a whole slot value is that null — it does not become a second,
distinct value that happens to live inside a Json slot. A slot declared
Json therefore cannot hold it, for the same reason Float cannot hold null
([LNUL.3.1]); a slot declared Json? can, and holds the canonical null.
The rule runs in both directions. It does not touch nulls inside a
document:
{"a": null} is an object, a legal value in a Json slot, and a leaf-read of
that null yields the canonical null as a value rather than absence
([LNUL.8.4]). What is forbidden is a whole slot value that is nothing but a
JSON null, in a slot that declared it can never be null.
An implementation must not carry two representations of null reachable
as a slot value. Two would defeat [LNUL.2.1]'s guarantee directly: they would
need to hash, encode, order and compare identically while being observably
different on read-back.
ratified — checks: idris×2 — see also: LNUL.2.1, LNUL.3.1, LNUL.8.4
Predicate semantics — the load-bearing decision [LNUL.4]#
[LNUL.4.1] Value level — null propagates. Every operator other than
and / or ([LNUL.4.2]), ?? ([LNUL.8.9]) and is ([LNUL.4.9]) propagates
null: the arithmetic, bitwise ([LEXP.7.7]) and comparison operators, the
interval relational operators ([LINT.4.5]) and the regex match operators
([LREG.1.1]). Such an operator with a null operand, and no operand that faults
([LNUL.4.10]), yields null ("unknown"): with s.state absent, s.state + 1,
s.state & 1, s.state > 85 and s.state == 5 all evaluate to null. A regex
match on an absent string neither matches nor fails to match, so the activation
continues for neither ~ nor !~ ([LNUL.4.3]).
There is no exception. is null / is not null ([LNUL.4.9]) are a
different operator, not a special case of this one, which is what makes
propagation uniform rather than nearly-uniform.
The examples are written with a binding whose value is absent rather than a
null literal, because a literal operand of == / != is a compile error
([LNUL.4.4]).
ratified — checks: alloy×2 k idris×18 — see also: LEXP.7.7, LINT.4.5, LNUL.4.10, LNUL.4.2, LNUL.4.3, LNUL.4.4, LNUL.4.9, LNUL.8.9, LREG.1.1
[LNUL.4.2] Boolean level — Kleene 3-valued logic. and / or / not
operate over {true, false, null} by the standard Kleene tables:
|
|
|
|
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
and not true = false, not false = true, not null = null.
A fault is absorbed, not propagated, by a deciding operand. An operand
faults when evaluating it raises a trap ([LERR.1.4.1]), a TypeError or an
EngineError ([IRET.9.6]). and is false if any operand is false, wherever
it stands and whatever the others raise; it is a fault only if no operand is
false; and it is null only if none is false and none faults. or is the
dual: true if any operand is true. An implementation may evaluate the
operands in any order and may stop at a deciding operand.
An EngineError from anything but evaluating the operand — resource
exhaustion, a pump_wcet_ns overrun ([LERR.1.4.7]) — is not an operand's
fault. It halts the tier whatever the expression would answer.
When several operands fault and none decides, the expression yields one
fault, chosen by kind first — EngineError, then TypeError, then the trap
kinds in proto/engine_error.proto#TrapKind value order — and within a kind by
the fields of the record the fault is recorded as, in field-number order,
excluding clock_ns and seq ([RFCS.21.1]): at the first field that differs,
the lower value wins. A string field compares by its UTF-8 bytes as unsigned
values, a proper prefix before any longer string, and a field the record leaves
unset compares as its protobuf default, the empty string or 0. The
offending operand's slot context ([LERR.9.12]) is among the fields compared.
Two faults that tie on every field record identically. An operand's position never enters, so a and b and
b and a agree on every input, faults included.
Absorption and distributivity do not hold once faults exist: null and (null or t) is the fault t, not null. Commutativity, associativity, De
Morgan and double negation do.
ratified — checks: alloy×12 k×3 idris×10 — see also: IRET.9.6, LERR.1.4.1, LERR.1.4.7, LERR.9.12, RFCS.21.1
[LNUL.4.10] A null operand does not absorb a fault. For every operator other than
and / or ([LNUL.4.2]) and ?? ([LNUL.8.9]), and for the arguments of every builtin
call, the engine must yield the result of evaluating every operand. If an operand faults,
as [LNUL.4.2] defines it, the expression yields a fault whatever the other operands are,
null included; [LNUL.4.1]'s propagation applies only when no operand faults.
When several operands fault, the expression yields one, chosen by [LNUL.4.2]'s order. An
operand's position never enters, so a + b and b + a yield the same fault on every
input. Only that fault reaches a surface ([LERR.1.4.11]). The engine may evaluate the
operands in any order.
A null operand still prevents the operation itself ([LNUL.9.3]), and a fault comes only
from evaluating an operand or from performing the operation. So x / z with x null and
z zero is null: the division is not performed, and there is no zero divisor to refuse.
ratified — checks: idris×4 — see also: LERR.1.4.11, LNUL.4.1, LNUL.4.2, LNUL.8.9, LNUL.9.3
[LNUL.4.3] A where clause fires iff it evaluates to true. Both false
and null (unknown) do not fire. Net effect: a missing value never
causes a rule to fire — neither positively (s.state > 85) nor through
negation (not (s.state > 85)) — unless the author handles absence explicitly
([LNUL.5]). This is the safe, auditable default: don't act on what you don't
know.
ratified — checks: alloy×2 idris×7 — see also: LNUL.5
[LNUL.4.4] is null / is not null are the total null test — they return
true / false, never null ([LNUL.4.9]), and they are the only way to branch
on absence inside a predicate.
== null and != null are a compile error
(DS_VALIDATE_NULL_LITERAL_COMPARISON). A null literal as either operand
of == or != is refused — x == null, null == x and null == 5 alike.
Keying on the operand rather than on one position is deliberate: a right-only
rule is evaded with the space bar, and the check is syntactic, with no type
interaction.
What this does not reach. Two non-literal operands that may both be null at
runtime — a.x == b.x — is cross-pattern join equality, it stays legal, and
[LNUL.8.2] is the clause that governs it.
ratified — checks: alloy×2 k idris×2 — see also: LNUL.4.9, LNUL.8.2
[LNUL.4.5] How a where predicate over a null slot s.state: Float? decides
whether the pattern matches:
Predicate |
Value when |
The pattern matches |
|---|---|---|
|
|
no |
|
|
no |
|
|
no: the author substituted |
|
|
yes |
A missing reading therefore fires neither a comparison nor its negation; a
null-as-false reading would fire the negation. is null is the only way to act
on absence ([LNUL.4.4]). s.state == null is a compile error: == propagates
null, so it could never be true.
ratified — see also: LNUL.4.4
[LNUL.4.7] Negated-existence blocks on null (the negation half of "don't
fire on unknown"). [LNUL.4.3] pins the positive case; the negated-existence
quantifier must match it, or the silent-wrong-fire this design exists to kill
sneaks back through negation. A negated-existence pattern no P where C is
satisfied iff, for every fact matching P, C evaluates to false. A fact for
which C is true (a match) or null (unknown) blocks satisfaction, and
so does a fact for which evaluating C raises a fault ([LERR.1.4]): C has not
evaluated to false, and the fault is recorded as any fault is. So
no Sensor s where s.state > 85 ("no sensor is hot") does not fire while
any sensor's state is null — you cannot conclude "none hot" while a reading is
unknown. This is the same principle as the positive case, not a special one
(null = unknown → don't conclude, whether the rule asserts presence or
absence); it surfaces as "null behaves like false positively, like true
under negation," but both are one rule. Cost-neutral: the alpha-memory scan
already visits those facts and now tests for null-C as well as true-C.
Combines with the pattern-level rule ([LNUL.8.3]).
ratified — checks: alloy×3 k idris×5 — see also: LERR.1.4, LNUL.4.3, LNUL.8.3
[LNUL.4.8] A GUARD admits on null, and that is the opposite of
[LNUL.4.3]. A guard is an engine-evaluated expression that decides whether an
already-matched activation is withheld — the compiler-emitted cooldown gate
is the one v1 has ([IRET.25.5.1]). Where the guard evaluates to null, the
runtime must let the activation proceed. Only an explicit false suppresses.
A time-dependent condition that the runtime reads beside the gate is not a guard ([RDSC.4a.8.2.2]): it decides whether the rule matches, and [LNUL.4.3] governs it.
The value is still null and Kleene still holds ([LNUL.4.2]); what this clause
settles is the disposition of null at this site, which [LNUL.4.3] settles
the other way at its own.
Why the two differ, because a single default cannot serve both. A where
clause decides whether a rule matches: declining to fire on an unknown is
cautious, recoverable, and visible in the next cycle when the value arrives —
don't act on what you don't know. A guard decides whether a rule that has
already matched is held back. Suppressing on an unknown does not decline to
act; it deletes the rule for as long as the value is absent, and nothing
distinguishes that from a rule whose conditions are simply never met.
So the safe direction inverts with the site. A guard that cannot establish grounds for suppression has not established them, and the activation stands. Firing more often than the author intended is bounded and observable; a rule that silently ceases to exist is neither.
⚠ No test can distinguish the two policies, which is why this needs stating rather than discovering. The two agree on every value that evaluates, so a suite over evaluable data returns identical results under either. Only an unevaluable guard separates them, and a fixture has to be written to produce one.
see also: LNUL.4.3, LNUL.4.2, IRET.25.5.1, RDSC.4a.8.2.2
[LNUL.4.9] x is <subject> / x is not <subject> — the total tag test.
The operator tests the value's tag ([LNUL.9.1]'s discriminant) against a
closed set of subjects. It must answer true or false for a value of
any kind: it must not yield null and must not raise. is not is one
operator, not not applied to is.
The subject set is closed and is not the type namespace. A schema has no representation of its own, so it is neither spellable as a subject nor answerable by one. The twelve subjects are six distinguished constants and six tag names:
subject |
|
|---|---|
|
the value is |
|
the tag is |
|
the tag is |
|
the tag is |
|
the tag is that one, whatever the value |
false in every other case, including when the value is null and the
subject is not null.
A constant tests tag and value; a tag name tests the tag alone. So
is Float is true of inf, -inf and NaN alike, and is Bool is true
of false.
A tag names a representation, not a declared type, and an annotation riding
on a representation does not change it. A unit-typed value is an Int or a
Float carrying a compile-time dimension ([LUNI.4.1]); a Time is an Int
carrying an ingestion-fixed zone offset, and [LTIM.1.1.1] already orders,
compares and computes on its utc_ns alone. Each answers to the tag that
carries it:
type |
answers |
|---|---|
|
|
a unit-typed value |
|
|
nothing — |
A value whose representation is none of the six answers false to all six.
That is what makes the partition total without the subject set having to name
every type: a type reaches this operator only through the tag that carries it,
and a type no tag carries is invisible to it rather than an error.
The answer is a function of the value alone. An implementation must
answer alike for two values alike in representation, however each reached the
operator: a Time written by a clock and an epoch Int asserted by an
integrator into the same slot are indistinguishable here, even where the
implementation separates them internally. Provenance is not a tag.
The tag is read before any value conversion. This is what makes totality
achievable for a Json string leaf: the tag is on the term, so is String
answers without interning anything.
Why totality is load-bearing. A guard that could fail on the condition it
guards is not a guard. [LNUL.4.1]'s propagation makes every ordinary operator
yield null on a null operand, so absence cannot be branched on by
arithmetic or comparison; this operator is the one that can, and every stricter
disposition elsewhere rests on it never failing.
ratified — checks: idris×12 — see also: LNUL.4.1, LNUL.9.1, LTIM.1.1.1, LTIM.1.3.1, LUNI.4.1
Narrowing, coalescing, defaults [LNUL.5]#
[LNUL.5.1] Using a T? where a concrete T is required is a compile error
unless narrowed. A concrete T is required in a concrete-value position — an
emit / publish slot value into a non-nullable slot, a call / function
argument, the receiver or an argument of a builtin that demands a value of a
particular kind, a typed let RHS, or a series source ([LNUL.8.6]) — anywhere a
null would corrupt a computed value.
The basis is the Kleene domain, and the predicate boundary is not the test.
The list is exhaustive on that basis rather than by enumeration: a null is
refused exactly where it passes to a consumer that does not propagate it. The
Kleene consumers are the operators: every operator [LNUL.4.1] makes propagate,
and and / or ([LNUL.4.2]). One builtin is among them, math.fma, which
takes its operands as x * y + z does ([LEXP.3.2.2]). Every other consumer
demands a value, and refuses one that may be absent.
So a builtin is refused inside a where, and that is an instance of the rule
rather than an exception to it. A builtin that demands a value of a particular
kind raises on the wrong kind instead of propagating, so a null reaching one
has left the Kleene domain without leaving the predicate. Its receiver is
refused on the same terms as its arguments: method form and function form denote
one builtin, and a rule that turned on which the author wrote would make a
null legal or illegal by punctuation.
String interpolation is not a concrete-value position: a null / absent
interpolated value renders as the empty string ([LGRA.2.9.6.2]), so
"{s.state}" on a Float? slot compiles and renders a null as "". This
is the property that makes absence un-ignorable (the one win worth keeping from
Maybe): the compiler forces handling there, so an unexpectedly absent slot
can't silently feed a wrong value into an action. It does not apply to
the operators, which are the Kleene consumers ([LNUL.4.1] / [LNUL.4.2]): they
accept a T?, propagate null, and the where fires iff true ([LNUL.4.3]). The single rule: a T?
outside a narrowing site is a compile error wherever its consumer demands a
value, and Kleene-evaluated (null-propagating) wherever its consumer
propagates. So a bare
s.state > 85 on a Float? slot compiles and simply does not fire on a
null reading ([LNUL.4.3]) — the safe default, not an error — and so does
s.state + 1 > 5, for the same reason and by the same mechanism.
ratified — see also: LEXP.3.2.2, LGRA.2.9.6.2, LNUL.4.1, LNUL.4.2, LNUL.4.3, LNUL.8.6
[LNUL.5.2] Guard narrowing. Inside x is not null and <…>, flow typing makes
x a T (non-null) in the right operand. Same for the where-clause tail
after an is not null conjunct. The narrowing is scoped to the where-clause (the
remaining conjuncts); it does not flow across the LHS→RHS boundary into the
action body. An action referencing a binding guarded on the LHS still sees it as
T? and must handle absence at each concrete-value position with ?? — there is
no LHS→RHS data-flow analysis ([LNUL.5.4]). So Sensor s where s.state is not null -> emit Out(value = s.state) is a compile error (value is a non-nullable slot);
the author writes value = s.state ?? 0.0.
Narrowing is a typing rule, not an evaluation order. It decides which
positions type-check; the conjuncts may still be evaluated in any order
([LNUL.4.2]). A narrowed conjunct evaluated before its guard meets the null
the guard excludes, and may raise; the guard is then false and absorbs what it
raised, so the conjunction answers as though the guard had run first.
The guard is spelled is not null and not != null: the latter is a compile
error ([LNUL.4.4]), and it could not have narrowed anything anyway, because a
propagating comparison never establishes that the operand is present.
ratified — see also: LNUL.4.2, LNUL.4.4, LNUL.5.4
[LNUL.5.3] Coalesce ??. x ?? d (with d : T) has type T: yields x
when non-null, else d. Restores opt-in old behaviour explicitly, e.g.
cached("k") ?? "" when an author genuinely wants empty-string-on-miss. The dimensions of x and
d are [LUNI.8.8]'s.
A fault is not null ([LNUL.4.2]). When evaluating x faults, the expression
yields that fault, and the engine must not evaluate d: ?? stands in for
an absent value, never for a failed computation.
ratified — checks: alloy×2 k idris×4 — see also: LNUL.4.2, LUNI.8.8
[LNUL.5.4] Narrowing is exactly two mechanical cases — the flow-typing
boundary that holds the "small dsc lift, no inference engine" promise.
Narrowing of a T? to T occurs in exactly two cases: (a) the tail of a
where conjunction after an x is not null and guard, where x is T in the
remaining conjuncts ([LNUL.5.2]); and (b) the result of x ?? d (d : T), which
is T ([LNUL.5.3]). No other construct narrows — not or, not
not (x is null), not a prior let, not nested or cross-rule flow. The
consequence of not narrowing is position-dependent ([LNUL.5.1]): a T?
outside a narrowing site is a compile error in a concrete-value position, and
Kleene-evaluated (null-propagating) in a where-predicate. So s.state is null or s.state > 85 compiles: s.state is still T? at > 85, but a comparison in
a where propagates null ([LNUL.4.1]), so with a null reading s.state is null is true and true or null is true (Kleene) — the rule fires. That
is a semantic gotcha, not a compile error: the or did not narrow, so the
intended guard silently didn't apply. An author who wants "hot, treating a missing
reading as not-hot" writes (s.state ?? 0.0) > 85 or s.state is not null and s.state > 85. The cost is an occasional explicit guard a cleverer compiler would
infer — the deliberate price of a fully predictable, two-case narrowing model with
no data-flow-analysis subsystem in dsc.
The guards are spelled with is throughout. != null and == null are
compile errors ([LNUL.4.4]). Narrowing is keyed on the total null test and
never on the propagating comparison.
ratified — checks: alloy k — see also: LNUL.4.1, LNUL.4.4, LNUL.5.1, LNUL.5.2, LNUL.5.3
[LNUL.5.5] The fallible cast ::T? is a T? producer. A fallible conversion
<expr>::T? ([LCST.4.2.2]) yields a T? and feeds the consumers
above — ?? ([LNUL.5.3]), Kleene logic ([LNUL.4.2]), and narrowing ([LNUL.5.4]) —
with no new machinery. Runtime null-propagation: when the source is nullable and
evaluates to null, null::T? yields null; a bare null::T (a total target on
a nullable source) is a compile error ([LCST.4.2.3]), not a runtime propagation —
so null reaches a cast result only through a ? target.
see also: LCST.4.2.2, LCST.4.2.3, LNUL.4.2, LNUL.5.3, LNUL.5.4
Determinism [LNUL.6]#
[LNUL.6.1] null is a single canonical value; the Kleene tables and the
null-tests are fixed and total; comparison and boolean ops are
integer/enumerated. So null is fully replay-deterministic and
cross-platform bit-exact — it involves no floating-point operation at
all, only integer tag comparisons.
[LNUL.6.2] Ordering is pinned: for the internal deterministic total order
(fact ordering / dedup / hash) null sorts below all values ([LNUL.8.1]), so
any total order over T? is deterministic. (Author-facing order operators
</>/min/max over a T? still propagate null per [LNUL.4.1]; the
below-all substrate order and the 3-valued comparisons coexist.)
[LNUL.6.3] Wire / hash. null gets a pinned DSC encoding — the
DS_SLOT_NULL slot-value kind and the nullable Slot flag ([RDSC.7.1]) — and a pinned 64-bit hash value ([LNUL.8.8],
cf. the pinned series element-hash). In a recorded fact body a null is an
absent optional field, distinct from the type's zero ([RFCS.6.3]), so
cross-engine replay is bit-identical.
Scope / boundary [LNUL.7]#
[LNUL.7.1] null lives on the data plane: nullable slots (T?), Json
null (already representable), call-response fields, and cache miss (cached()
returns T?). It replaces the "" sentinel: a cache miss is a real
null. A call's correlation is never absent ([LCRS.3.1]), so it needs neither.
see also: LCRS.3.1
[LNUL.7.2] A series aggregation is nullable exactly where it is
undefined. A cold read ([LSER.19.8]) of a counting, membership, sum or
signal aggregation yields its concrete zero; every other aggregation is T? and
yields null while cold. In a where predicate that null propagates and the
rule does not fire ([LNUL.4.3]), so a cold read needs no guard there; at a
concrete-value position it is rescued with ?? or written to a T? slot
([LNUL.5.1]).
A series sample is never null. A series over a T? source absorbs a
null sample by its declared policy ([LNUL.8.6]), so the only null an
aggregation yields is the cold one.
ratified — see also: LNUL.4.3, LNUL.5.1, LNUL.8.6, LSER.19.8
[LNUL.7.3] by: none is unaffected. That none means "no partition key"
— a configuration marker, not a missing value — and stays a distinct keyword
from null.
Null semantics commitments [LNUL.8]#
[LNUL.8.1] Null ordering — below-all. For the internal deterministic total
order (fact ordering / dedup / hash), null sorts below all values — the
substrate tie-break that cannot be narrowed away. Author-facing order operators
(</>/min/max) over a T? still propagate null ([LNUL.4.1]); the two
coexist ([LNUL.6.2]).
[LNUL.8.2] Join equality on two absent values. Cross-pattern join
equality a.x == b.x is non-matching when both are null (SQL-style).
Forced by bounded-RT: matching null-keys would make N null-keyed facts
mutually join → O(N²) tokens → DS_ERR_TOKEN_BUDGET. Nullability must not
become a token-budget DoS.
[LNUL.8.3] A null slot value still matches the pattern. A fact whose
nullable slot is null matches — null is a slot value, not fact
absence; only where filters. The negated-existence case is [LNUL.4.7].
see also: LNUL.4.7
[LNUL.8.4] Surface + JSON absence. Schema/adapter syntax is T?.
JSON's two missings are
pinned distinct: has(path) == false is absent; a path present with JSON
null reads as null; an absent path reads as null too. has() is
the only absence test; a leaf-read of a present-JSON-null is a value
(null), not absence.
A path does not resolve where a segment addresses a value that is not its
container: a key into an array or a scalar, or an index into an object or a
scalar. Such a path is absent, as a missing key is: it reads as null, and
has of it is false.
A path read whose root is null, a Json? slot holding none, has no document
to resolve against. The engine must yield null for it and must not
raise a fault, so the read propagates as an operator over a null operand does
([LNUL.4.1]). has demands a document, and the compiler refuses it over an
unnarrowed Json? root ([LNUL.5.1]).
ratified — checks: idris×14 — see also: LNUL.4.1, LNUL.5.1
[LNUL.8.6] Series null-absorption. A series over a T?
source is a compile error unless it declares a null-absorption policy:
skip (drop the sample), hold (repeat the last absorbed value) or zero
(absorb 0). Each is deterministic and bounded. There is no default — the
author must decide how dropout is handled, or the window is non-deterministic
and signal-wrong ([LNUL.7.2]).
This is not [LSER.13.5.1]'s gap phrase, and the two must not be
conflated. They answer different questions that happen to admit the same
three answers:
gapis a time-axis policy — how a time-integrating aggregation advances across an interval in which no sample was asserted. Onlyintegralhas that axis, which is why [LSER.13.5.1] admits the phrase there and nowhere else.null-absorption is a value policy — what the series does with a sample that was asserted and carries
null. Every aggregation over a nullable source faces it.
An empty window is neither: it is a cold read, which yields the aggregation's cold value ([LSER.19.8]). So a non-integrating aggregation needs no gap policy, and a series over a nullable source still needs this one.
The declaring phrase is therefore not gap. It is the nulls: option of
the series declaration ([LSER.13.5]), and one policy covers every aggregation
over that slot.
The compiler must refuse a series over a
T?source that omitsnulls:, withDS_VALIDATE_SERIES_NULLS_REQUIRED.The compiler must refuse
nulls:on a series whose source is not nullable, withDS_VALIDATE_SERIES_NULLS_ON_NON_NULLABLE: there is nonullfor the policy to absorb.The compiler must refuse
nulls: zerounless the source isInt?orFloat?, unit-typed or not, withDS_VALIDATE_SERIES_NULLS_ZERO_NON_NUMERIC: absorbing 0 has no meaning for any other kind.Under
hold, the engine must keep the value anullrepeats for the instance's life. Eviction after a window of silence ([LSER.9.3.2]) does not forget it, and anullarriving after eviction absorbs it into the fresh allocation. Anullarriving before any value has been absorbed absorbs nothing. The read stays cold ([LSER.19.8]); the engine must not hold anull.
ratified — defined in: proto/series_backend_ring_buffer.proto#SeriesNullPolicy — see also: LNUL.7.2, LSER.13.5, LSER.13.5.1, LSER.19.8, LSER.9.3.2
[LNUL.8.7] A nullable Time is an ordinary nullable value; the time axis
is never null. The one slot a construct orders facts by is ts, and [LFAC.9.1]
requires it to be a Time that is not nullable. within and dwell read no
slot ([LTIM.2.8.6]). No other slot is a time axis, so the compiler must admit a
Time? slot of any other name, and a null in it Kleene-propagates
([LNUL.4.1]), as a null in a Date? or a Duration? does.
see also: LFAC.9.1, LNUL.4.1, LTIM.2.8.6
[LNUL.8.8] Pinned null hash. The reserved null-hash is a pinned 64-bit constant, so hash-backed aggregations stay cross-platform bit-identical.
see also: RDSC.5
[LNUL.8.9] ?? evaluation order — lazy, uniform (no mode-split). x ?? d
evaluates d only when x is null (lazy short-circuit), in both
realtime and non-RT. The mode must not change it: d can fault where x is
present (x ?? y / z), so eager evaluation would raise a fault the lazy form
never meets, and a mode-dependent choice would make the same program behave
differently under realtime than without it. Unlike the operands of and /
or ([LNUL.4.2]), x and d are not interchangeable, so this order is part of
the meaning. WCET is unaffected — the worst case (x null → evaluate d) has the same bound
as eager.
ratified — checks: k idris×3 — see also: LNUL.4.2
[LNUL.8.10] Nullable identity/key slot — forbidden. A key / identity slot
must be non-null: the compiler refuses a nullable identity slot with
DS_VALIDATE_NULLABLE_KEY. Identity relies on total equality,
and null breaks it — under the [LNUL.8.2] split a null key is non-matching
against another null (SQL-style), so a nullable identity silently (a) defeats the
logical one-live-per-identity upsert invariant (two null-keyed facts are
distinct identities, never coalesce, and accumulate without bound), and (b)
degenerates the identity hash, since every null key hashes to the pinned
DS_NULL_HASH64 ([LNUL.8.8]) yet compares non-equal — a single-bucket O(N) probe
chain of mutually-non-matching facts, the same bounded-RT / token-budget DoS
[LNUL.8.2] exists to forbid, moved onto the identity plane. Key markers are
logical-only, so this forbids exactly the meaningless case (a null identity) and
nothing else.
Representation and runtime cost [LNUL.9]#
[LNUL.9.1] Representation: null is a kind, not a box. It is one more
discriminant on the existing tagged slot value (kind + v union) —
zero extra bytes per slot, no heap, no Option indirection. This is what
makes T? viable on a 264 KB-RAM-class target (RP2350) and is the concrete
meaning of "flow-typed, not boxed" ([LNUL.3.2]). The kind-tag must not be
"optimised" into a wrapper or a box.
see also: LNUL.3.2
[LNUL.9.2] The Rete network stays 2-valued. Because where fires only on
true ([LNUL.4.3]), node activation is match/no-match; the Kleene tri-state
lives only inside a single node's expression evaluation and never propagates as
tokens — no tri-state join state, no new network shape.
see also: LNUL.4.3
[LNUL.9.3] No new ULP surface, by short-circuit. A null operand
short-circuits the arithmetic/comparison (the float op is never executed), so
null adds no new ULP surface and no transcendental — only integer tag
compares ([LNUL.6.1]). WCET-bounded.
checks: idris — see also: LNUL.6.1
[LNUL.9.4] Opt-in runtime cost. Compile-time flow typing ([LNUL.5]) emits a null tag-check only where the author guards or coalesces — no implicit per-read null checks. Code size and WCET are unaffected for non-null slots, which remain the default.
see also: LNUL.5
Absent arguments on the RHS [LNUL.11]#
[LNUL.11.1] A verb's argument may be null — one absent value, not a
separate sentinel ([LNUL.7.1]). What each RHS verb does with a null argument:
Verb |
Policy |
|---|---|
|
a |
|
a slot declared |
|
the call is not made, and the firing's other actions run ([NCBK.6.8]) |
|
the stored value may be |
cache stores null as itself, because a cache entry has no declared type
to refuse it. The consequence is deliberate: after this, a cached(key) miss and a stored
null are indistinguishable at the read ([LSTO.4.3.1a]). An author who needs to
tell them apart stores a sentinel of their own choosing.
This table is over arguments to VERBS, and that is its whole scope. A value
consumed as a boolean is ruled elsewhere and the two answers differ by site: a
where clause does not fire on null ([LNUL.4.3]); a guard admits on it
([LNUL.4.8]). Neither is a case of this clause.
A fault is not this. A fault raised while evaluating an argument never
reaches the verb, whichever verb holds the argument: the engine handles it as
[LERR.1.4] states, and a ComputationError or a TypeError abandons the
activation. A trap has no honest answer, is not an absent value, and
never reaches a slot ([LERR.1.4.9], [LCST.4.5.4]) — it abandons the activation
instead.
Abandoning is a PREFIX rule, not a rollback. A trap stops the action sequence at the point it occurs: actions already performed stand, and actions after it do not run. Nothing is undone, because a DS activation is not atomic — the verbs have already reached the integrator's callbacks and the engine has no way to recall them. So a rule that emits, then traps, then would have published has emitted and not published, and the stream shows exactly that.
Stated because "abandons the activation" reads as though the activation leaves no trace, and the half of it that already ran is the half an operator has to reason about.
checks: idris×11 — see also: LCST.4.5.4, LERR.1.4, LERR.1.4.9, LGRA.2.9.6.2, LNUL.4.3, LNUL.4.8, LNUL.7.1, LSTO.4.3.1a, NCBK.6.8, RARC.5.2.7