From 94c6b23a5d36c4ee2ef26d6e1722f5c301707613 Mon Sep 17 00:00:00 2001 From: Chase Crawford Date: Fri, 17 Jul 2026 19:04:37 -0400 Subject: [PATCH 1/2] docs(spec): complete type-system sections (Scalar/Enum/Complex/Collection/Entity) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fulfill the S-02 [O01.01.01.02] skeletons in docs/specification.md: - §2.3.4.1 Scalar: // contracts, coercion and null semantics. - §2.3.4.2 Enum: rules, underlying-value assignment. - §2.3.4.3 Complex: completion rules, read-only/nullable member semantics, computed-member signature contract. - §2.3.4.4 Collection: List/Set/Dictionary container kinds, // rules, duplicate/ordering semantics. - §2.3.4.5 Entity: rules, composite keys, key immutability. - §2.3.6 Option vocabulary; §2.3.6.2 type-default effective-capability table. Closes #19 Co-Authored-By: Claude Fable 5 --- docs/specification.md | 327 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 317 insertions(+), 10 deletions(-) diff --git a/docs/specification.md b/docs/specification.md index 79ccaec..6c04665 100644 --- a/docs/specification.md +++ b/docs/specification.md @@ -212,33 +212,291 @@ A Scalar represents a single, indivisible value derived from a primitive type ``` -*[Owned by S-02 [O01.01.01.02]: full scalar rules — ``/`` contracts, -constraints, coercion, and the default query capability of each scalar kind (§2.3.6.2).]* +A Scalar's runtime contract is fixed by a single `` and refined by optional +`` and `` children. + +**``** + +| Attribute | Values | Meaning | +| --- | --- | --- | +| `Type` | `Integer` \| `Float` \| `String` \| `Boolean` | the primitive root the Scalar derives from | + +**Rules** +1. A Scalar Type MUST declare exactly one `` child. +2. `PrimitiveType.Type` MUST be one of the four primitive roots `Integer`, `Float`, `String`, + `Boolean`. This revision defines no other primitive roots; named value domains such as dates + are Scalars that refine `String` with a `` (below), not new primitives. +3. The primitive root fixes the Scalar's underlying value space and equality semantics. Two + Scalars sharing a root are still distinct Types and MUST NOT be treated as interchangeable + (§2.3.4 rule 2). + +**``** + +A `` narrows the lexical representations a Scalar accepts. + +```xml + + + + + +``` + +| Attribute | Values | Meaning | +| --- | --- | --- | +| `Pattern` | a format token | one acceptable lexical form of the value | + +**Rules** +1. A Scalar MAY declare zero or more `` children. A Scalar with no `` accepts the + canonical lexical form of its primitive root. +2. When one or more `` children are declared, a value MUST match at least one declared + `Pattern` to be valid; a value matching none MUST be rejected. +3. The first declared `` is the **canonical serialization form**: a runtime that emits the + value MUST render it using the first `Pattern`, even when the input matched a later one. +4. `` is meaningful only on a `String`-rooted Scalar; a `` on any other primitive + root MUST be rejected. + +**``** + +Constraints bound the value domain beyond what the primitive root and formats express. They are +portable, source-agnostic facets (mirroring `