is

is (leftValue rightValue -- isIdentityLike)

Inputs

Outputs

is compares dereferenced values by identity-like equality.

All same-schema inputs are accepted. Identity-like equality is meaningful for Ref, Text, and Code values. Other same-schema inputs return FALSE.

is answers a different question from = and same. Use = for dereferenced value equality and same for dereferenced schema identity.

Behavior

Example

{} 0 {} [
  nilCode: {} () {} codeRef;
  compiledCode: {} () {} codeRef;
  [] !compiledCode
  first: 7;
  second: 7;
  textA: 0 ("") dynamic @;
  textB: 0 ("") dynamic @;

  "-- In-place values --" printCompilerMessage
  7 7 same printStack _:;
  7 7 = printStack _:;
  7 7 is printStack _:;

  "-- Ref values compare target identity --" printCompilerMessage
  @first @first is printStack _:;
  @first @second is printStack _:;

  "-- text compares contents --" printCompilerMessage
  "hi" "hi" is printStack _:;
  "hi" "ho" is printStack _:;

  "-- unknown supported values can produce unknown Cond --" printCompilerMessage
  textA textB is printStack _:;

  "-- code --" printCompilerMessage
  @nilCode @nilCode is printStack _:;
  @compiledCode @compiledCode is printStack _:;

  0
] "main" exportFunction

Expected Output During Compilation

-- In-place values --
TRUE
TRUE
FALSE
-- Ref values compare target identity --
TRUE
FALSE
-- text compares contents --
TRUE
FALSE
-- unknown supported values can produce unknown Cond --
Cond
-- code --
TRUE
Cond

See also