ADR 0068 — Multi-block detection (strict mode)
- Status: accepted
- Date: 2026-05-24
- Spec target: XTL 0.1
- Affects: language.md (Data Blocks); impl (parser); 1 new error code
Context
ADR-0066 established column-scoped data blocks but limited a sheet
to at most one block, with disconnected marker clusters raising
xl3/expression/bracket-outside-block at parse time. ADR-0067
introduced the @block directive for explicit boundary declaration.
The remaining design question: when both implicit detection and
explicit @block directives are in play on the same sheet, how
does the engine decide which cells belong to which block? Two
competing models:
- Permissive (mixed-mode) — explicit
@blockdirectives claim their rectangles; any leftover marker cells outside all explicit blocks form an additional implicit block subject to ADR-0066's cluster rules. Friendly for migrating an existing single-block template by adding a sidebar via just one new@blockon the sidebar. - Strict — if a sheet has any
@blockdirective, ALL marker cells on that sheet MUST be inside some@blockrectangle. Mixed mode is forbidden; the implicit auto-detection runs only when zero@blockdirectives are declared.
Permissive is friendlier per-migration; strict is friendlier per- review and per-spec.
Considered Options
A. Strict mode (this ADR). One-of:
- ZERO
@blockon sheet → ONE implicit block per ADR-0066's rules. Cluster-completeness check applies (multiple disconnected clusters raisexl3/expression/bracket-outside-block). - ≥1
@blockon sheet → all marker cells must lie inside some@blockrectangle. Orphan markers raisexl3/expression/bracket-outside-block. No implicit cluster detection runs.
B. Permissive (mixed) mode. @block directives claim their
rectangles; leftover marker cells form additional implicit blocks
subject to ADR-0066 cluster checks. Up to N+M total blocks per
sheet (N explicit + M implicit).
C. No-mix forbidden — sheets are either all-implicit or all-explicit. Same as strict A but framed as a sheet-mode toggle. Effectively equivalent to A.
Option A chosen. Strict mode trades a small one-time migration
cost (when an author wants a second block, they must add @block
to the existing block too, not just the new one) for substantial
review and debugging clarity:
- Reading a template's first
@blockinstantly tells the reader "this sheet uses explicit blocks; check the others." No silent hidden implicit block. - Adding a stray marker reference somewhere on the sheet immediately raises an error pointing at the location, rather than silently extending or creating a new implicit cluster.
- Conformance testing the "any
@blockpresent" rule is a one-line predicate; mixed mode requires per-cell membership tracking across N explicit + M implicit blocks.
The migration cost is bounded: a real-world transition adds one
@block directive cell to the existing block (one keystroke
effort). Existing templates without @block continue to work
unchanged via ADR-0066 implicit detection.