code? (schema -- isBlock)
Inputs
schema: Object orRefwhose dereferenced schema is tested forBlock.
Outputs
code? is a dereferenced-schema predicate. It tests whether the dereferenced schema is Block.
The name is historical: code? is the Block test, while codeRef? is the Code test.
Ref inputs are followed before the test. Current value contents do not participate.
code? is not a general callability test. Use codeRef? for Code schemas and call to attempt an actual call.
Behavior
Example
"String" use
{} 0 {} [
codeLocal: {} () {} codeRef;
textLocal: 0 ("") dynamic @; # an unknown Text
[("-- code call --\n") printList] !codeLocal # a non-NIL Code
"-- code? versus codeRef? --" printCompilerMessage
[("-- block call --\n") printList] code? printStack _:;
[("-- block call --\n") printList] codeRef? printStack _:;
@codeLocal code? printStack _:;
@codeLocal codeRef? printStack _:;
"-- not a general callability test --" printCompilerMessage
«1 +» code? printStack _:;
textLocal code? printStack _:;
[("-- block call --\n") printList] call
@codeLocal call
0
] "main" exportFunction
Expected Output During Compilation
-- code? versus codeRef? --
TRUE
FALSE
FALSE
TRUE
-- not a general callability test --
FALSE
FALSE
Expected Output
-- block call --
-- code call --
See also
alignmentbuiltin(schema -- alignment)Returns the storage alignment requirement of the dereferenced schema.callbuiltin(inputs... callable -- outputs...)Calls an already-selected callable instead of testing its schema.codeRef?builtin(schema -- isCode)Codedereferenced-schema test.isCombinedbuiltin(schema -- isCombined)Struct-group dereferenced-schema test.managed?builtin(schema -- isManaged)Managed-lifetime dereferenced-schema test.samebuiltin(leftSchema rightSchema -- isSameSchema)Exact dereferenced-schema equality test.schemaNamebuiltin(schema -- reportedName)Reported name of the dereferenced schema.storageSizebuiltin(schema -- size)Returns the storage size of the dereferenced schema.virtual?builtin(schema -- isMeta)Historical Meta dereferenced-schema test.