Conversation
…oduce= rather than over= and into= The keywords the call names a walk with go back to the pair #437 used and #477 renamed. `by=`, `along=`, `within=` and `window=` are unchanged, and so are `piecewise: over:` and `sos: over:`, which name a declaration's axis and not a call keyword. The rename is whole: the operator signatures, every error message, the reference pages, every example, the generated schema and the golden model. The three golden outputs are byte for byte what they were, which is the claim this spelling makes — it prints the same math. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ZhdyUr2JZZYcBzTuJrRKx
Documentation build overview
24 files changed ·
|
Contributor
Author
|
Closed in favor of #534 Will revisit for syntax discussions |
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.
A sixth proposal for #516, and the only one that is a naming change alone:
main's shape with the two walk keywords back to the pair #437 used and #477 renamed. It writes all fourteen cases of #516 and prints the same math. It is also the only one that reaches a model with no relation in it — one keyword out of six.Note
The following content was generated by AI.
What this changes
over=isconsume=andinto=isproduce=, onsumand onat.by=,along=,within=andwindow=are unchanged.piecewise: over:andsos: over:are unchanged, because they name a declaration's breakpoint axis and not a call keyword — sooverstops being one word for two things.The first line is the point, and the cost.
sum(x, over=d)with noby=is the most common call in any model, and the four relational proposals (#502, #499, #515, #509) all leave it exactly asmainhas it. This is the one proposal that touches it. In this tree that is 164 of the 221 keyword occurrences underexamples/anddocs/— three quarters of the diff is models that declare no relation at all.The rename goes no further than that one keyword. I ran every relation-free call on all six branches.
sum(p),shift(x, along=t, offset=1, edge=0),sum_back(x, along=t, window=4)andposition(t)are the same call and the same math on all six.shift(…, over=t, …)andsum_back(…, over=t, …)are refused on all six,mainincluded — theover=→along=half of #477 is settled and this PR does not reopen it.athas no relation-free form anywhere: a read needs a table to read through.What the rename buys, in three lines that
over=did not give:Walk.consumedandWalk.producedalready carry these words. feat(language): relations replace lookups, walked with over= and into= rather than consume= and produce= #477 kept them on purpose. The call and the program now say one word per concept.over=meant two directions. Onsumit names the column removed; onatthe same keyword names the column the read starts from. Both areWalk.consumed, andconsume=says so.over=takes.consume=takes the thing consumed: a dimension without aby=, a key column with one.The rename is whole — the operator signatures, every error message, the reference pages, every example, the generated schema and the golden model.
GroupSum.over,At.overandSum.overkeep their names: they wereover/intobefore #477 too, and onAtthey flip with the adjoint, so they are not the keyword under another spelling.The cases of #516, in this spelling
The calls with no relation in them, which are where this proposal differs from the other four:
sum(p)sum(p, consume=generator)shift(x, along=t, offset=1, edge=0)sum_back(x, along=t, window=4)position(t)by=The fourteen relational cases:
sum(p, by=gen_bus)sum(p, by=zone_of, consume=generator, produce=zone)sum(p, by=slot_of, consume=generator, produce=bus)sum(p, by=slot_of, consume=generator, produce=[bus, technology])sum(p, by=slot_of, consume=[generator, period], produce=bus)sum(p, by=slot_of, consume=[generator, period], produce=[bus, technology])sum(f, by=ends, consume=line, produce=bus1)at(price, by=gen_bus)at(cap, by=ends, consume=bus0)shift(x, along=t, offset=1, by=cal, within=week)position(t, by=cal)position(t, by=cal, within=week)sum(p, by=connection, consume=generator, produce=bus)sum(y, by=l, consume=a, produce=b)— bindsl,a,bAll of them load, cases 3 and 4 included, and each prints the math #516 records for it.
Verified
pixi is unreachable from this session, so every gate ran in a uv venv on Python 3.13 with the pinned ruff 0.16.1, pyrefly 1.2.0, typos, reuse and prettier 3.9.3.
pytest -q: 1290 passed, 6 skipped.ruff check,ruff format --check,prettier --check,typos,reuse lint: clean.pyrefly check: the same 11 errors as the base branch in this environment, all missing stubs for pydantic and yaml.mkdocs build --strict: passes with thedocs.python.orginventory dropped for the run, since the proxy answers 403 on it. The committedmkdocs.ymlis unchanged.schema/math-spec.schema.json, the three golden outputs, the gallery pages,notation.md,operators.md,README.md,docs/index.md.origin/main@bc1d9d4, feat(language): a sum and a read name their direction in direction=, as a -> b #502 @21cd2a9, feat(language): a relation's direction is written inside by=, as relation(a -> b) #499 @9311dfb, feat(language): over=rel.k and by=rel.v name a relation's columns after its name #515 @b55dc42, feat(language): a relation is summed with over=/by= and indexed with x[rel] #509 @4b4796e.The strongest evidence is the golden output.
tests/typesetting/golden/model.yamlmoved 18 lines andlatex.out,markdown.outandtypst.outare byte for byte what they were. A keyword rename cannot touch the math, and the committed files say so.Not run:
compile-tex(no tectonic here) andtaplo(no.tomlchanged).Two test ids named the old keywords and follow it:
by-and-over-composeisby-and-consume-compose,into-without-byisproduce-without-by. No assertion changed.Not done, on purpose
along=stays. feat(language): a relation between dimensions, walked in the direction each call names #437 spelled the ordered axisover=as well. That half of feat(language): relations replace lookups, walked with over= and into= rather than consume= and produce= #477 is a separate decision and this PR does not reopen it; 0c and 0d above are the check that it is settled on all six branches.overstays, intests/test_expansion.pyand theweighted_sumexample on the expressions page.kwargs: [over]withtemplate: sum(array * weights, consume=over)is what the tree carried before feat(language): relations replace lookups, walked with over= and into= rather than consume= and produce= #477, and it still shows that a formal may be named after a word the language no longer reserves.GroupSum.over,At.over,Sum.overandRelationNode.intostay, for the reason above.dimensions.mdis cut rather than renamed. "over=names the column consumed andinto=the column produced" is a restatement once the keyword is the word, so the paragraph keeps only the rule: name a column only where the relation offers two.Why
#516 compares five syntaxes for the same walk and finds that every one of them prints the same math. What is left to choose on is the spelling, and this is the spelling that names the two ends of the walk in the words the program already uses for them. It writes the two cases #509 cannot, without the arrow of #499 and #502 and without #499's whole-or-nothing rule on case 6.
Bryn's objection on #437 was that
consumeandproduceare energy-system words. The counter-argument this PR makes is that they are also the two words this codebase uses for the walk, and thatoverwas carrying the declaration axis, the English "sum over", and one of two directions at the same time. The counter-cost is case 0b: this is the only proposal that rewrites a model with no relation in it.🤖 Generated with Claude Code
https://claude.ai/code/session_017ZhdyUr2JZZYcBzTuJrRKx