Skip to content

Commit 875bd56

Browse files
Decide whether a node type may be defined outside the kernel (#1026) (#1040)
Entity is a public abstract record with a protected constructor, which reads as an invitation to derive from it, and five of its eleven abstract members are internal or private protected, so a subclass in another assembly fails to compile with CS0534 naming exactly those five. That is the blocker under #746 items 53 and 56 and under Packaging.md's "blocked, not decided" for domain packages -- item 56 attributes the seam to #338, looking a type up so it can be parsed, which is the second half of it. The decision is to open the contract without publishing anything: four of the five are engine machinery with a default the kernel can supply and be right about -- Priority is read only by the printers, SortHashName is a deduplication table over kernel node kinds, ToSymPy already throws from a base class for a node SymPy has no name for, and an empty inversion is what a third of the node types already return. Only IntrinsicCondition has no safe default: Boolean.True is the positive claim that an operation is total, and only the node's author knows whether it holds, so it becomes protected abstract. Publishing the five instead would drag two internal enums and 30 frozen enum values into the public API for the same capability. The document costs the alternative -- a closed hierarchy extended by data -- against that, and records why it is not the status quo either: Number.Real, Rational, Complex and Variable are concrete and unsealed, and a subclass of one compiles against the nupkg today and goes through Simplify and Solve intact. The defaults were given to a node kind the kernel has never seen and run through the pipelines EveryNodeSurvivesEveryPipelineTest uses. Sixteen of the seventeen held, including like-term grouping and the provided machinery. The one that did not is a twelfth obligation written nowhere: every node type carries `ToString() => Stringize()`, and without it the record-synthesized ToString recurses through Entity.PrintMembers until the stack guard fires. Claude-Session: https://claude.ai/code/session_01Bjumi5K7fg8yx6UK1mZTQd Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 0e68b16 commit 875bd56

2 files changed

Lines changed: 347 additions & 1 deletion

File tree

0 commit comments

Comments
 (0)