stable?

stable? (value -- isStable)

Inputs

Outputs

stable? is the current stack-value stability predicate. It tests whether the current stack value is currently stable.

This predicate follows the referenced target for known non-NIL Ref values. It is the exact opposite of isDirty. Compile-time knownness and forgotten-contents state do not by themselves determine the result. Current stack Code values are tested by the current Code value itself, not by callability. User-visible creation paths such as codeRef and block assignment to Code still report FALSE.

Behavior

Example

{} 0 {} [
  value: 7;
  unknownValue: 0 dynamic;
  unknownText: 0 ("") dynamic @;
  codeLocal: {} () {} codeRef;
  [] !codeLocal

  "-- current stability versus forgotten-contents stability --" printCompilerMessage
  7 known? printStack _:;
  7 stable? printStack _:;
  7 unknownStable? printStack _:;
  7 isDynamic printStack _:;
  unknownValue known? printStack _:;
  unknownValue stable? printStack _:;
  unknownValue unknownStable? printStack _:;
  unknownValue isDynamic printStack _:;

  "-- references --" printCompilerMessage
  @value stable? printStack _:;
  @value unknownStable? printStack _:;
  @value isDynamic printStack _:;
  @unknownValue stable? printStack _:;
  @unknownValue unknownStable? printStack _:;
  @unknownValue isDynamic printStack _:;
  0nx value addressToReference stable? printStack _:;
  0nx value addressToReference unknownStable? printStack _:;
  0nx value addressToReference isDynamic printStack _:;

  "-- text, code, meta --" printCompilerMessage
  "hi" stable? printStack _:;
  "hi" unknownStable? printStack _:;
  "hi" isDynamic printStack _:;
  unknownText stable? printStack _:;
  unknownText unknownStable? printStack _:;
  unknownText isDynamic printStack _:;
  {} () {} codeRef stable? printStack _:;
  {} () {} codeRef unknownStable? printStack _:;
  {} () {} codeRef isDynamic printStack _:;
  @codeLocal stable? printStack _:;
  () stable? printStack _:;
  () unknownStable? printStack _:;
  () isDynamic printStack _:;

  0
] "main" exportFunction

Expected Output During Compilation

-- current stability versus forgotten-contents stability --
TRUE
TRUE
FALSE
FALSE
FALSE
TRUE
TRUE
TRUE
-- references --
TRUE
FALSE
FALSE
TRUE
TRUE
TRUE
FALSE
FALSE
FALSE
-- text, code, meta --
TRUE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
FALSE
TRUE
FALSE
FALSE

See also