Skip to content

refactor(program)!: the node a use of a named expression stands as is NamedExpression, beside NamedMask, and Named is gone - #822

Merged
FabianHofmann merged 9 commits into
claude/trusting-allen-xp0tgbfrom
refactor/named-expression
Oct 6, 2026
Merged

FabianHofmann merged 9 commits into
claude/trusting-allen-xp0tgbfrom
refactor/named-expression

Conversation

@FBumann

@FBumann FBumann commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Prompt: Do this as a refacotr afterwards, as a stacked PR! With its own release note etc! No deprecation! … Its a breaking refactor!

Note

The following content was generated by AI.

What this changes

Breaking. mathspec.program.Named is now NamedExpression, so it reads as the pair of #821's NamedMask. No alias is kept, so an import of Named fails. This PR is stacked on #821.

Before After
from mathspec.program import Named from mathspec.program import NamedExpression
isinstance(node, Named) isinstance(node, NamedExpression)

Why

#821 adds NamedMask, a pass-through over a masks: entry's predicate. Named is the same kind of node over an expressions: entry's arithmetic. They stay two classes because Expression and Predicate are two closed node sets with their own walks. One class in both sets would break every assert_never match. The names now say which set each node belongs to.

Method, gate output, release note, what is not done

Method. One regular expression renames the identifier Named and leaves the prose alone: "Named expression 'e'" in messages, the "Named expressions" headings, and the test docstrings that use the word. The touched code is program.py (the class, __all__ and the union), resolution.py, lowering.py, dimensions.py, boundedness.py, typesetting/walk.py and _expression_resolver.py. Also touched: tools/gallery.py, four test files, and docs/reference/reading.md. Every remaining Named was checked, and each one is in prose.

Base merged. The updated #821 branch, which now holds main with #664, is merged here (06d874f). Three conflicts were imports and one assertion, in boundedness.py, tests/test_expansion.py and tests/typesetting/test_golden.py. #664 renamed GroupSum and Pullback to Join, and added Axis. The resolution keeps #664's nodes and spells NamedExpression. No Named identifier remains.

Release note. The title and the changelog line carry !, as feat!: did in 0.2.0. By the AGENTS.md rule, a release that breaks an import raises the minor version, so the next release is 0.3.0, and its notes name this break. specsolve, or any consumer that matches on the node, changes one import and the isinstance checks that use it.

  • tools.changelog entry reads the type refactor before the !, and finds the line.
  • The title check's pattern admits !.

Base merged again (ca1afd5). The #821 branch now holds main with #793 and #844. The merge was clean, and the regenerated files did not change. #821's two new _READS_ORDER cases pass here too: a mask still goes through #793's order check after the rename.

Gates (on ca1afd5).

  • pixi run ci: exit 0. That is lint, 2733 passed and 1 skipped, strict docs-build, and compile-tex (54 documents).

Not done.

  • No deprecation alias, as asked.
  • No other renames.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PBmqeqBrqpQC6MVoSrguHK

…NamedExpression, beside NamedMask, and Named is gone

mathspec.program.Named is renamed NamedExpression, so the two pass-through
nodes read as a pair: NamedExpression over an expressions: entry's
arithmetic, NamedMask over a masks: entry's predicate. No alias is kept;
a consumer that imports Named imports NamedExpression instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PBmqeqBrqpQC6MVoSrguHK
@FBumann
FBumann requested a review from brynpickering as a code owner October 1, 2026 15:18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PBmqeqBrqpQC6MVoSrguHK
@FBumann
FBumann added this pull request to stack #823 October 1, 2026 15:19
@read-the-docs-community

read-the-docs-community Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PBmqeqBrqpQC6MVoSrguHK
@FBumann FBumann changed the title refactor(program): the node a use of a named expression stands as is NamedExpression, beside NamedMask, and Named is gone refactor(program)!: the node a use of a named expression stands as is NamedExpression, beside NamedMask, and Named is gone Oct 1, 2026
@FBumann FBumann added the area: composition Assembling a model from files, and fixing a decision label Oct 2, 2026
@FBumann
FBumann removed this pull request from stack #823 October 2, 2026 06:51
@FBumann FBumann added area: where What a where predicate may say and removed area: composition Assembling a model from files, and fixing a decision labels Oct 2, 2026
@FBumann
FBumann added this pull request to stack #831 October 2, 2026 06:52
@FBumann FBumann added the v0.3.0 label Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: where What a where predicate may say v0.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants