Combining and dividing mpath pointers #18
Labels
No labels
bug
duplicate
enhancement/documentation
enhancement/feature
enhancement/organization
question
rejected
upstream
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
UserCurt/mpath#18
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?
This feature request is to develop a method to compose or decompose mpaths more easily without using strings. There are a couple approaches:
MPath builder with method chaining: The idea is to create a fluent interface to repeatedly apply method calls to build up an MPath Pointer. The details on the best way to do this has not beet fully determined, but below shows a number of approaches:
This can help with building up an MPath but not decomposing an MPath.
A limitation of the notation like
mp = mpath.Builder.A.("*").SetDimension(2).ToPointer()is that there could be naming conflicts.MPath composition: The idea is to define addition operation on MPaths as a way to combine existing mpaths. To do away with parsing strings and to rather work with operations directly, there should be methods to construct pointers that are single operations.
I wonder if it would be possible to have operations in the
mpath.operationnamespace to inherit mpath.Pointer so that this new interface could be avoided altogether.For decomposition, perhaps operations should be opened up to the public API, including construction using operations. For example: