docs: ADR-33 — record why UnaryTestVal stays a distinct variant
public
docs: ADR-33 — record why UnaryTestVal stays a distinct variant Capture the design rationale for not folding `(< 10)` into a `Range` + `is_test` flag: a single type is feasible (equality is the only observable difference and the CmpOp is recoverable from the range fields) but worse — it admits illegal two-bounded "test" states, turns `is_test` into a cross-cutting flag honoured by equality/string/Allen-exclusion yet ignored elsewhere, and discards the newtype-over-range framing the spec (§10.3.2.7 type vs 0068 identity) implies. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| Changeset | c8ff352aa500059b22f13b1ac90a2815b2851326 |
|---|---|
| Author (claimed) | Timo Stolz <timo.stolz@gmail.com>, |
| Parents | 6be256e6f4ba |
| Children | |
| Pushlog | by timo via ssh |
modified DECISIONS.md +24 −0
| @@ -1241,6 +1241,30 @@ | ||
| 1241 | 1241 | nonetheless `≠ [10..10]` is exactly what 0068 + 0074 jointly demand; `member_access` is a |
| 1242 | 1242 | *read*, not a promotion. `feel_equal_depth`'s `UnaryTestVal` arms (ADR-32) are unchanged, as is |
| 1243 | 1243 | the 40-byte `Value` size. |
| 1244 | +- **Why a distinct variant, not `Range` + an `is_test` flag.** Once `(< 10)` projects to the | |
| 1245 | + *same* `start`/`end`/inclusivity as `(..10)` (and `(= 10)` to the same as `[10..10]`), the only | |
| 1246 | + observable difference is **equality** — so one *could* fold both into a single | |
| 1247 | + `Range { start, end, start_open, end_open, is_test }` whose `=` also compares `is_test` (the | |
| 1248 | + `CmpOp` is recoverable from the canonical range fields, so no operator need be stored). That was | |
| 1249 | + weighed and **rejected**: | |
| 1250 | + - **Illegal states.** A comparison test is grammar rule 7.a — *one* operator, *one* endpoint — | |
| 1251 | + so the compact `{ op, endpoint }` makes a two-bounded "test" (`Range { start: 5, end: 10, | |
| 1252 | + is_test: true }`, which matches no FEEL expression) **unrepresentable**. The unified form | |
| 1253 | + admits it, plus redundant denormalised endpoint fields that can drift. | |
| 1254 | + - **A cross-cutting flag.** `is_test` would have to be *honoured* by equality, `string()` | |
| 1255 | + (`(< 10)` vs `[10..10]` rendering) and the Allen-relation exclusion (ADR-32: `as_interval` | |
| 1256 | + → `None`), but *ignored* by `in`-membership, `member_access`, `instance of` and `range()`. | |
| 1257 | + Honoured in ~3 ops, ignored in ~15 — and the silent default (forgetting the bit) is wrong for | |
| 1258 | + equality, right elsewhere. A distinct variant makes "no range identity / not orderable" a | |
| 1259 | + *type* fact, not a flag every present and future range op must remember. | |
| 1260 | + - **It is idiomatically a newtype over range.** §10.3.2.7 makes it range-typed for *type and | |
| 1261 | + properties* while 0068 proves it is *not* substitutable for a range under *identity* — "same | |
| 1262 | + projected shape, own identity" is the textbook newtype, i.e. a distinct value, not a runtime | |
| 1263 | + discriminator. The small projection-logic overlap (the Table-42 mapping) is shared by reuse, | |
| 1264 | + not by merging the types — a `UnaryTestVal` helper if it ever grows, never a unified `Value` | |
| 1265 | + variant. (Hard TCK data is only `(<10) ≠ (null..10)` and `(=10) ≠ [10..10]`; `(<10) ≠ (..10)` | |
| 1266 | + is our principled extension of 0068's "never equal to a `Range`", and a unified flag would | |
| 1267 | + have to carry exactly that case too.) | |
| 1244 | 1268 | - **Tests:** `range_properties` extended with the six-operator property table, the |
| 1245 | 1269 | unknown-property null, and the `instance of range<T>` conformance (incl. a wrong-endpoint-type |
| 1246 | 1270 | `false`). Re-ingested **only** `0074-feel-properties` (the five `range_006`/`007`/`009`/`010`/`011` |