Use a shared traversal engine #40
Labels
No labels
bug
duplicate
enhancement/documentation
enhancement/feature
enhancement/organization
question
rejected
upstream
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
UserCurt/mpath#40
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
get,set,remove,existseach invokeresolveprior to getting, setting, or removing. This means they effectively need to traverse the hierarchy twice. Each method is then responsible for the part that comes after, which can have some shared logic.This issue proposes creating one shared internal traversal engine that walks the path once no matter the method, and within the traversal engine, take action depending on which public method is used on the terminal targets.
Add focused tests showing that
resolve,get,set, andremoveshare traversal behavior, including comma-separated-list branches and overloaded indexing cases where grouping matters.Contracts to preserve
With this change, resolve would not be invoked first within
get,set,remove,exists. Nevertheless, after this issue is tackled, contracts related to callingresolvefirst should still be satisfied. In particular:Stability Under Bare Resolve
Resolved Input Equivalence
Whether resolve is called first or not, the result of an operation should be the same in most normal circumstances. For example:
Get-Set Round Trip
Setting values to obtained values should preserve the data.
Behavior in this contract could be dependent on issue #35.
With issue #41 in mind, "take action" would add to a queue rather than applying the mutation itself in
setandremoveCommit
c6165e6begins the shared traversal-engine work.resolvenow uses a dedicated scalar traversal entry point that returns source-aware traversal rows. Concrete rows also retain the terminal values they reached, allowing later consumers such asgetto use the same traversal without replaying resolved paths.The next step is to make
getconsume these traversal results directly.Commit
1ee3c6bcontinues the shared traversal-engine work by separating shape planning from pointer construction. The next step is to migrategetaway from calling and replayingresolve.Commit
7ff390fnow hasgetuse the shared traversal pipeline. It no longer callsresolvefirst and then traverses again to fetch values.Still need to migrate
exists,set, andremoveto the shared traversal pipeline.Commit
193d59anow hasexistsusing the shared traversal pipeline. It no longer callsresolvefirst before checking for existence.Still need to migrate
setandremoveto the shared traversal engine.Completed by commit
a03e30b, which handledsetandremove.set#10