📝 Document why open universes are rejected
Add a README Caveats subsection with user-facing guidance for the two open-universe shapes: parse external input at the boundary down to a finite union, or use a runtime Map registry for extensible domains. Point the finite-universe bullet at it, and point the rejected fix/open-universe-* entry in development/library.md back at the new guidance, so rule and decision cross-reference without duplicating each other.
This commit is contained in:
1 parent
11d364e187
commit
4260a4732c
2 files changed
+16
-1
No files matched your search
@@ -40,6 +40,19 @@ Yet to be implemented
|
||||
- **`NaN` and `-0` cannot be matched specifically.** They have no literal type,
|
||||
so both stay part of `number`.
|
||||
|
||||
### Why open universes are rejected
|
||||
|
||||
An open universe — one carrying a broad member, as in
|
||||
`type Units = "s" | "ms" | "min" | (string & {})` — is not a dispatch concern.
|
||||
If the values arrive from outside the program, parse them at the boundary down
|
||||
to a finite union and match the narrowed result; the openness never reaches the
|
||||
matcher. If the domain is genuinely extensible, the right shape is a runtime
|
||||
`Map` of handlers, where "no handler" is a lookup, not a pattern. Either way an
|
||||
open matcher would abandon the one guarantee this library exists to give —
|
||||
provable exhaustiveness — to automate what a `switch` and a default arm already
|
||||
cover. The type-level cost of supporting open universes is recorded in
|
||||
[development/library.md](./development/library.md#supported-universes).
|
||||
|
||||
## License
|
||||
|
||||
MIT © 2025 tmu. See [LICENSE](./LICENSE).
|
||||
|
||||
Reference in new issue
Block a user