Each object can tell who is its parent.
These parent pointer are maintained automatically at a very low cost (single move instruction).
This ability simplifies the handling of document data models and can facilitate integrity checks if needed.
sys_getParent(existingObject)
Function sys_GetParent returns
- object in which field this object is located,
- or array object if it's in an array,
- or null if this object is not nested in another object.
Function result is ?sys_Object.
This parent pointers also assist a new "splice" operation, that allows to extract an existing object from one part of the object hierarchy and insert it in other place:
temp = object.field; // save the link to object stored somewhere
object.field := newValue; // make it not stored there anymore
// or
object := newValue; // or destroy the hierarchy it belonged
anotherParentObject.field @= temp // "splice" this object in another place.
This allows to reorganize object hierarchies in safe and effortless manner (previously it required a copy operation).
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.