This page defines the schema-level vocabulary used by the reference.
A schema kind is a primary schema family. A schema group is a named set of schemas defined by a criterion.
Schema Kinds
| Kind | Common sources | Description |
|---|---|---|
Block |
[...] |
Compile-time block schema. Meta. |
Code |
codeRef, importFunction, exportFunction |
Callable code schema whose exact signature belongs to the schema. |
Cond |
DEBUG, FALSE, TRUE, predicate results |
Condition schema used by branching and logical condition operations. |
Dict |
{...} with named fields |
Struct schema with named items. |
Int8 |
Integer literals with i8 |
8-bit signed whole-number schema kind. |
Int16 |
Integer literals with i16 |
16-bit signed whole-number schema kind. |
Int32 |
Integer literals with default integer syntax or i32 |
32-bit signed whole-number schema kind. |
Int64 |
Integer literals with i64 |
64-bit signed whole-number schema kind. |
Intx |
Integer literals with ix |
Pointer-width signed whole-number schema kind. |
List |
array, uniform (...), uniform unnamed {...} |
Struct schema with unnamed items of one shared item schema. |
Nat8 |
Natural literals with n8 |
8-bit unsigned whole-number schema kind. |
Nat16 |
Natural literals with n16 |
16-bit unsigned whole-number schema kind. |
Nat32 |
Natural literals with n32 |
32-bit unsigned whole-number schema kind. |
Nat64 |
Natural literals with n64 |
64-bit unsigned whole-number schema kind. |
Natx |
Natural literals with nx |
Pointer-width unsigned whole-number schema kind. |
Real32 |
Real literals with r32 |
32-bit floating-point schema kind. |
Real64 |
Real literals with default real syntax or r64 |
64-bit floating-point schema kind. |
Ref |
NAME, .NAME, @NAME, .@NAME, @, fieldRead |
Reference schema kind. The schema defines the target schema and mutability. For non-static, non-callable In-place objects, NAME and .NAME push immutable views; @NAME and .@NAME push mutable views, and a field's view is mutable only when the enclosing Dict is reached through a mutable path. |
Text |
"TEXT", «TEXT», & |
UTF-8 text schema kind. A non-empty literal is stored as exactly its UTF-8 code units, with no terminating zero byte. |
Tuple |
Non-uniform (...), empty (), non-uniform unnamed {...} |
Struct schema with unnamed items whose item schemas are not required to match. The empty value () is a Tuple. |
Schema Groups
| Group | Criterion | Where it matters |
|---|---|---|
Int |
Schemas whose kind is Int8, Int16, Int32, Int64, or Intx. |
Signed Int operations and comparisons. |
Meta |
Schemas of zero size. | Compile-time-only objects and schema-level operations. Tested by virtual?, which follows a Ref and tests the dereferenced schema. |
Nat |
Schemas whose kind is Nat8, Nat16, Nat32, Nat64, or Natx. |
Nat operations, counts, and address-like values. |
Number |
Schemas in the Whole or Real groups. | Arithmetic, numeric comparisons, casts, and numeric transforms. |
Real |
Schemas whose kind is Real32 or Real64. |
Floating-point transforms such as cos, log, and sqrt. |
Ref-like |
Schemas whose kind is Ref, Code, or Text. |
isRef and fieldIsRef. |
Scalar |
Schemas in the Cond kind or the Number group. |
Scalar value operations and comparisons. |
In-place |
Schemas whose values are stored directly at their own runtime location. | Default runtime data path. Numbers, Cond, and non-Meta Struct schemas are In-place. Contained fields may still be Ref-like; the term describes the outer schema, not recursive field contents. |
Struct |
Schemas whose kind is Dict, List, or Tuple. |
Struct schema operations such as isCombined, fieldCount, fieldIndex, fieldName, and has. |
Whole |
Schemas in the Int or Nat groups. | Bitwise operators and shifts such as and, lshift, rshift, xor, and ~. |
Common operational consequences
- Non-static, non-callable In-place locals and fields are read through Ref views rather than copied; see selection and views for mention, call, and mutability rules. Writing with
!NAMEreplaces the stored value;setwrites through a mutable view. - Ref-like objects use special value rules of their own kinds.
Refcopies or replaces references,Textcopies text values, andCodefollows callable-code rules. - Meta objects are compile-time objects. Operations that require runtime object storage reject them or create fresh compile-time objects instead of reading or writing stored runtime objects.
- Whole, Number, Scalar, Int, Nat, and Real are arithmetic grouping terms used to state builtin acceptance and result rules concisely.
Example
Schema kinds and groups
{} 0 {} [
"-- schema kinds --" printCompilerMessage
[] schemaName printStack _:;
{x: 0;} schemaName printStack _:;
(1 2) schemaName printStack _:;
0n32 schemaName printStack _:;
"hi" schemaName printStack _:;
"-- schema groups --" printCompilerMessage
{x: 0;} isCombined printStack _:;
(1 2) isCombined printStack _:;
[] code? printStack _:;
{} () {} codeRef codeRef? printStack _:;
() virtual? printStack _:;
0n32 managed? printStack _:;
0
] "main" exportFunction
Expected Output During Compilation
-- schema kinds --
"«test.mpl» 3 3 Block"
"{x: Int32;}"
"Int32 2 array"
"Nat32"
"Text"
-- schema groups --
TRUE
TRUE
TRUE
TRUE
TRUE
FALSE
Properties that are not schema kinds or schema groups
- Mutability is not a schema kind or schema group.
- Known versus unknown is not a schema kind or schema group.
- Stable versus unstable is not a schema kind or schema group.
- Static declaration state is not a schema kind or schema group.
- Exact callable signatures are not schema kinds or schema groups.
- Exact
Dict,List, andTupleitem layouts are not schema kinds or schema groups.
Where to continue
- For syntax that creates these schemas, see Node Reference.
- For operations that inspect or manipulate them, see Built-in Reference.
- For exact schema predicates, see builtins such as
code?,codeRef?,isCombined,managed?,same, andvirtual?.