docs: align LANGUAGE_CONTRACT + GRAMMAR with #405 call semantics and #406 catch binding (#492)#519
Merged
Conversation
…406 catch binding (#492) Both docs marked pre-#405 / pre-#406 behavior as Enforced while SPEC.md and the suite are the truth. Rewrote to match: - Function calls / argument unpacking: brackets after `of` are an argument list at EVERY count (#405) — `f of []` zero args, `f of [x]` one arg (the element, not the list), `f of [a, b]` two; a variable never acts as an arg list; parenthesise to pass a list whole or make any one-arg call. Dropped the stale "length-1 literal binds the whole list" claim from LANGUAGE_CONTRACT and GRAMMAR. - #153 footgun: now a RESOLVED footgun — bracketed recursion on a defaulted fn (`fib of [n - 1]`) binds n = element and works after #405; point at lint W017 for the historical ambiguity. - catch binding (#406): a built-in runtime error binds `{kind, message, line}`, not just a message string; thrown values still bind unchanged. Runtime-verified: one of [7]->7, one of ([7])->[7], fib bracketed->55, built-in error e.kind=undefined_name, thrown string/dict preserved. Docs-only (no code/scripts); follow-up: no doc-drift gate covers LANGUAGE_CONTRACT/GRAMMAR (only SPEC/COMPARISON are byte-checked). Closes #492 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docs/LANGUAGE_CONTRACT.mdanddocs/GRAMMAR.mdstill described pre-#405 call-spread and pre-#406 catch binding while marked Enforced — fightingSPEC.mdand the suite. This aligns them.Changes
ofare an argument list at every count (f of []zero args,f of [x]one arg = the element not the list,f of [a, b]two); a list in a variable never acts as an argument list; parenthesise (f of ([x])/f of (x)) to pass a list whole or make any one-argument call. Dropped the stale "length-1 literal binds the whole list" claim from both docs.fib of [n - 1]) now bindsn = elementand works after Language change: a bare literal list after 'of' is ALWAYS an argument list (kill the 1-element spread trap) #405; points at lint W017 for the historical ambiguity.{kind, message, line}, not just a message string;thrown values still bind unchanged.Verification (runtime, v0.28.0)
one of [7]→7;one of ([7])→[7];fib of [n-1]→55dict,e.kind=undefined_name; thrown string stays a string, thrown dict preservedDocs-only (no code/scripts touched).
Follow-up (issue's item 5): no doc-drift gate covers
LANGUAGE_CONTRACT/GRAMMARtoday — onlySPEC.md+COMPARISON.mdfenced examples are byte-checked bytest_doc_examples.py. Extending the byte-check to these files would prevent this drift class but is a larger change; leaving as a note.Closes #492
🤖 Generated with Claude Code