Table of Contents
1. xcheck
Tests whether an object has the executable attribute.
1.2. Stack Effects
| Level | Object |
|---|---|
0 |
|
| Level | Object |
|---|---|
0 |
|
1.3. Description
xcheck tests whether the operand has the executable or literal attribute:
-
Returns
trueif the object is executable -
Returns
falseif the object is literal
This tests the executable/literal attribute only, not the access attribute (e.g., execute-only, readonly).
1.5. Examples
Checking names
/abc xcheck % false (literal name)
abc xcheck % true (executable name) - if abc is defined
Checking procedures
{ 1 2 add } xcheck % true (procedures are executable)
{ 1 2 add } cvlit xcheck % false (converted to literal)
Checking numbers and strings
123 xcheck % false (numbers always literal)
(text) xcheck % false (strings always literal)
1.6. Common Use Cases
1.7. Common Pitfalls
Tests Attribute, Not Access - xcheck does not test access permissions like execute-only.
|
% xcheck returns true even for execute-only objects
proc executeonly xcheck % true
| Most Objects Are Literal - Numbers, strings, and array literals are all literal by default. |
Combine with type - Use type to check object type along with executability.
|
1.9. Implementation Notes
-
Very fast operation (checks single bit in object header)
-
Does not modify the object
-
Works on any object type
-
Complementary test to attribute queries