same (leftSchema rightSchema -- isSameSchema)leftSchema: First value or Ref whose dereferenced schema is compared.rightSchema: Second value or Ref whose dereferenced schema is compared.same is a dereferenced-schema equality predicate. It tests whether two dereferenced schemas are identical.
All input values are accepted. Only the two dereferenced schemas participate in the result, so current value contents, value knowledge, and Ref mutability do not participate after dereferencing.
Different dereferenced schemas make same return FALSE instead of raising an error.
same therefore answers exact schema identity, not runtime compatibility or naming. Matching schemaName text does not imply same, and runtime comparisons such as = and is answer different questions.
Use same for exact dereferenced-schema identity, = for dereferenced value equality, and is for identity-like equality.
FALSE.TRUE. Different dereferenced schemas produce FALSE.{} 0 {} [
value: 0 dynamic;
"-- same schema, different values or value knowledge --" printCompilerMessage
0 1 same printStack _:;
0 dynamic 1 dynamic same printStack _:;
0 1 = printStack _:;
0 1 is printStack _:;
"-- different schemas give FALSE, not an error --" printCompilerMessage
0 0n32 same printStack _:;
7 FALSE same printStack _:;
"-- matching schemaName text is not enough --" printCompilerMessage
left: {
SCHEMA_NAME: "Point" virtual;
x: 0;
};
right: {
SCHEMA_NAME: "Point" virtual;
y: 0;
};
left schemaName printStack _:;
right schemaName printStack _:;
left right same printStack _:;
"-- references are dereferenced first --" printCompilerMessage
@value value same printStack _:;
"-- separate block literals have different schemas --" printCompilerMessage
[] [] same printStack _:;
"-- same block schema read twice --" printCompilerMessage
block: [];
@block @block same printStack _:;
"-- text schema only --" printCompilerMessage
"hi" "ho" same printStack _:;
"hi" "ho" = printStack _:;
"hi" "ho" is printStack _:;
0
] "main" exportFunction
-- same schema, different values or value knowledge --
TRUE
TRUE
FALSE
FALSE
-- different schemas give FALSE, not an error --
FALSE
FALSE
-- matching schemaName text is not enough --
"Point"
"Point"
FALSE
-- references are dereferenced first --
TRUE
-- separate block literals have different schemas --
FALSE
-- same block schema read twice --
TRUE
-- text schema only --
TRUE
FALSE
FALSE
alignment builtin (schema -- alignment) Returns the storage alignment requirement of the dereferenced schema.= builtin (leftValue rightValue -- isEqual) Dereferenced-value equality for same-schema Cond, numeric, and Text values.is builtin (leftValue rightValue -- isIdentityLike) Identity-like equality on same-schema values; Ref-like values can compare TRUE, while other same-schema inputs give FALSE.code? builtin (schema -- isBlock) Historical Block-schema test.codeRef? builtin (schema -- isCode) Code dereferenced-schema test.isCombined builtin (schema -- isCombined) Struct-group dereferenced-schema test.managed? builtin (schema -- isManaged) Managed-lifetime dereferenced-schema test.schemaName builtin (schema -- reportedName) Reported name of the dereferenced schema.storageSize builtin (schema -- size) Returns the storage size of the dereferenced schema.virtual? builtin (schema -- isMeta) Historical Meta-schema test.