Close

Argentum objects got parent pointers and safe-n-fast object reattachments

A project log for Argentum programming language

It automatically prevents all memory leaks. It doesn't use GC, so no pauses. It's compiled to machine code. It's crazy safe and fast.

andrey-kalmatskiyAndrey Kalmatskiy 04/27/2023 at 01:550 Comments

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

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).

Details and more examples are in this post.

Discussions