From cccf90980c8337d41aa256a7cfb76d86164986f5 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 15 Sep 2026 16:31:31 +0000 Subject: [PATCH] docs(language): the expressions page says why a case when: cannot compare expressions The page stated the refusal and its rewrite in one sentence, and said nothing about what makes a case `when:` different from every other `where`. The reason is the apartness proof: the loader enumerates a grid from the values each mask names, and a comparison of expressions names none. The paragraph now gives the reason, quotes the loader's own message word for word, and says that a variable's `where` and a constraint's `where` are not held to the rule. Sentence measure on the page, by the script in the docs-writing skill: n 139 avg 17.5 median 16 over25 27 before, n 144 avg 17.2 median 16 over25 26 after. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_011wswYDGW6H9n5Sod42NwUM --- docs/reference/language/expressions.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/reference/language/expressions.md b/docs/reference/language/expressions.md index 7efb3a0f..7840c1d4 100644 --- a/docs/reference/language/expressions.md +++ b/docs/reference/language/expressions.md @@ -249,10 +249,21 @@ constraints: expression: shed >= load - ramp ``` -A case `when:` that compares expressions cannot be proved apart from its -neighbours before the data arrives, so it is refused there with the rewrite: -compare one parameter against a literal, or precompute the test as a boolean -parameter. +A case `when:` may not compare expressions. The loader proves the cases of a +[`cases:` block](#the-rules-that-keep-the-cases-apart) apart at load: no two of +them may claim one coordinate. It proves that by trying every value the masks +name. A comparison of expressions names no value, because only the data decides +whether `c > 2 * k` holds. There is nothing to try, so the loader refuses the +block: + +> `Named expression 'e'`: cases `wide` and `narrow` cannot be told apart before +> the data arrives: it compares expressions, whose values only the data decides +> — compare one parameter against a literal, or precompute the test as a boolean +> parameter and test that. Two cases claiming one coordinate would give it two +> values, so this is refused the way a proven overlap is. + +A variable's `where` and a constraint's `where` are not held to this, because +neither is proved apart from anything. ### `position()`