Replace nested type wrappers with a flat transforms array - #136
Merged
Conversation
The seven wrapper type nodes and the nestedTypeNode recursive alias are removed in favour of a new transform category: one transform node per former wrapper (same attributes minus the inner type) plus a transformNode union documenting the ordering rule — applied in array order, first innermost. Every typeNode union member, links included, declares a trailing transforms attribute via a shared transformsAttribute helper, and every nestedUnion reference becomes a plain node reference (accountNode.data, enum variant payloads, numeric prefix slots). A type's kind is now stable whether or not it is modified, examples and doc-strings are swept to the transforms style, and the docs root legend only mentions recursive pages when nested unions exist.
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.
This PR implements #125: the
nestedTypeNodemechanism is gone, transforms are data on the type they modify.New
transformcategory:fixedSizeTransformNode,sizePrefixTransformNode,preOffsetTransformNode,postOffsetTransformNode,sentinelTransformNode,hiddenPrefixTransformNode,hiddenSuffixTransformNode(each a former wrapper minus its innertype, docs and worked examples carried over), plus thetransformNodeunion documenting the ordering rule: applied in array order, first is innermost —fixedSizeTypeNode(sentinelTypeNode(X))becomesXwithtransforms: [sentinel, fixedSize].Every
typeNodeunion member (17 standalone types +definedTypeLinkNode) declares a trailingtransformsattribute via a sharedtransformsAttribute()helper, so links can now be transformed directly.De-nesting: every
nestedUnion('nestedTypeNode', X)reference becomes a plainnode(X)—accountNode.data, enum struct/tuple variant payloads, and the numeric slots onenumTypeNode,booleanTypeNode,amountTypeNode,solAmountTypeNode,dateTimeTypeNode,optionTypeNode,prefixedCountNode.defineNestedUnionstays in the meta-model (the 1.x line uses it) but nothing in this spec does; the docs root legend only mentions (recursive) pages when nested unions exist.Counts: still 95 nodes (−7 wrappers, +7 transforms), 34 unions (+
transformNode). Examples using wrappers (events, discriminators, maps, structs, tuples) rewritten to the transforms style; doc-strings sweep (stringTypeNode, offset strategies, "wrapped" → "inner"/"transformed").Upgrade lens note (for
upgradeV1ToV2): mechanical — unwrap each wrapper chain inside-out, appending to the base type'stransforms; rename enum variantstruct/tupleand other nested slots' contents in place (their attribute names are unchanged).Closes #125 (manual close — default branch is
1.x). Part of #102.